Solved

Exhcange 2013 Calendar Permissions

Posted on 2014-10-15
5
261 Views
Last Modified: 2014-10-17
Hi,

I need to clear the calendar permissions on all mailboxes, for all users in my 2013 Exchange server. The only 2 that should be remaining is the default user and anonymous. Is there a script to perfom such a task?

For example :
I have a script, that can go through all the mailboxes, but it only deals with the user that I provide. I need it to take all the users, for example from a text file and go through the process with each and every one.

Get-Mailbox | ForEach-Object {Remove-MailboxFolderPermission $_":\Kalender" -User $Allusers -Confirm:$false} -Confirm:$False

Any Ideas?
0
Comment
Question by:ht_comp
  • 2
  • 2
5 Comments
 
LVL 63

Expert Comment

by:Simon Butler (Sembee)
ID: 40385520
I am not aware of any script that can do what you want.
You would need to enumerate the permissions first using get-mailboxfolderpermission, then take the results from that and remove them.

Closest I can get is the example at the end of this blog posting:
http://careexchange.in/working-with-calendar-permissions-in-bulk-on-exchange-2010-sp2/

Simon.
0
 
LVL 36

Accepted Solution

by:
Jian An Lim earned 500 total points
ID: 40385862
Let's write one
sorry, i don't have a working environment to test it so, if there is issues (assume it is hand coded so synxtax issue will be unavoidable ,) please let me know.
IF you know how it works, powershell is pretty much easy to understand anyway.

############

$mailboxes = Get-Mailbox -resultsize unlimited
 ForEach-Object ($mailbox in $mailboxes) {

$users = get-mailbox $mailbox | % {get-mailboxfolderpermission $_":\Calendar"}\  | ?
{$_.user -notlike "Default* -OR $_.user -notlike "Anony*"}}


if ($users -ne $null) {
Foreach-object  ($user in $users)
get-mailbox $mailbox | % {Remove-MailboxFolderPermission $_":\Kalender" -User $user -Confirm:$false}
}
}
0
 

Author Comment

by:ht_comp
ID: 40386131
Hi,

We tried to modify the script you provided, as it contained some slight errors, but now we are stuck at the last part of the script. The problem is with the $user value, as the user value must be either alias or smtp address but the $user contains Folder Name, User and Access Rights.

The slightly modified script at the moment:

$mailboxes = Get-Mailbox -resultsize unlimited
ForEach($mailbox in  $mailboxes) {

$users= get-mailbox $mailbox | % {get-mailboxfolderpermission $_":\Kalender"} | ? {$_.user -notlike "Default*" -AND $_.user -notlike "Anony*"}

if ($users -ne $null) {
Foreach  ($user in $users) {
get-mailbox $mailbox | % {Remove-MailboxFolderPermission $_":\Kalender" -User $user -Confirm:$false}
                                               }                
                                  }
}

And the error message:

Cannot process argument transformation on parameter 'User'. Cannot convert the "Microsoft.Exchange.Management.StoreTask
s.MailboxFolderPermission" value of type "Microsoft.Exchange.Management.StoreTasks.MailboxFolderPermission" to type "Mi
crosoft.Exchange.Management.StoreTasks.MailboxFolderUserIdParameter".
    + CategoryInfo          : InvalidData: (:) [Remove-MailboxFolderPermission], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Remove-MailboxFolderPermission
0
 
LVL 36

Assisted Solution

by:Jian An Lim
Jian An Lim earned 500 total points
ID: 40386187
great! add .user add the back will do.

Remove-MailboxFolderPermission $_":\Kalender" -User $user.User  -Confirm:$false
0
 

Author Closing Comment

by:ht_comp
ID: 40386390
Great solution - With the little modifications it worked very well.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question