Solved

Exhcange 2013 Calendar Permissions

Posted on 2014-10-15
5
254 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Synchronize a new Active Directory domain with an existing Office 365 tenant
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now