Solved

Exhcange 2013 Calendar Permissions

Posted on 2014-10-15
5
270 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 37

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 37

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
The viewer will learn how to count occurrences of each item in an array.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

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