Link to home
Start Free TrialLog in
Avatar of ht_comp
ht_comp

asked on

Exhcange 2013 Calendar Permissions

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?
Avatar of Simon Butler (Sembee)
Simon Butler (Sembee)
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
ASKER CERTIFIED SOLUTION
Avatar of Jian An Lim
Jian An Lim
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ht_comp
ht_comp

ASKER

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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ht_comp

ASKER

Great solution - With the little modifications it worked very well.