Solved

Exhcange 2013 Calendar Permissions

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
This video discusses moving either the default database or any database to a new volume.

821 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