Saturday, 28 December 2013

MS Exchange 2010 Calendar Management PowerShell

Exchange 2010 Calendar Management PowerShell

View permissions on a calendar

Get-MailboxFolderPermission –identity “user one:\Calendar”

For those who’d like to type less, instead of using –identity “user one:\Calendar”, you could omit the identity switch and use alias. Assuming user.one is an alias for “user one”, you could use:

Get-MailboxFolderPermission user.one:\Calendar

Give permissions to a new user

Add-MailboxFolderPermission –identity “user one:\Calendar” –User “user two” –AccessRights Editor

Change permissions on an existing user

Set-MailboxFolderPermission –identity “user one:\Calendar” –User “user two” –AccessRights Owner

For some reason, when someone who uses MS Office on a Mac wants to give delegate permission to a user, I have to give the Owner right other than anything else. A delegate normally gets the Editor right which is what a delegate needs but it messes up the original owner’s calendar when the delegate makes changes to the calendar items.

Remove permissions

Remove-MailboxFolderPermission user.one:\Calendar –User “user two” –Confirm:$false

Without the confirm:$false switch, you will have to type y to confirm removing.

Get items count on a calendar

Search-Mailbox –identity “user one” –SearchQuery kind:meetings -EstimateResultOnly

Delete all calendar items

Search-Mailbox –identity “user one” –SearchQuery kind:meetings -DeleteContent

Enable calendar repair assistance for a mailbox

Set-Mailbox –identity “user one” –CalendarRepairDisabled $false

Calendar Repair Assistance is managed on the server level but not on the individual mailbox basis. This implies that you have Server Management right. CRA does not run automatically by default. Therefore you will have to set it up.

Add-RoleGroupMember “Server Management” –Member “Admin User”

To configure CRA...

Set-MailboxServer –identity Exchange01 –CalendarRepairIntervalEndWindow 14
Set-MailboxServer –identity Exchange01 –CalendarRepairWorkCycle 7.00:00:00 –CalendarRepairWorkcycleCheckpoint 2.00:00:00
Set-MailboxServer –identity Exchange01 –CalendarRepairMissingItemFixdisabled $false

The above PowerShell cmdlets will trigger CRA to repair calendar on the mailbox server 14 days from the date it was set. Every 7 days the CRA will scan all mailboxes and flag to repair.   Every 2 days CRA will process those which are flagged to be repaired. To view what has been repaired you must use calendar repair logging feature. It is enabled by default. The default path for the log is inside the default exchange installation path\v14\Logging\Calendar Repair Assistant.

All in one go...
Set-MailboxServer –identity Exchange01 –CalendarRepairIntervalEndWindow 14 –CalendarRepairWorkCycle 7.00:00:00 –CalendarRepairWorkcycleCheckpoint 2.00:00:00 –CalendarRepairMissingItemFixdisabled $false

To configure CRA Logging...

Set-MailboxServer –identity Exchange01 –CalendarRepairLogEnabled $true
Set-MailboxServer –identity Exchange01 –CalendarRepairLogPath “D:\CRA LogFiles”
Set-MailboxServer –identity Exchange01 –CalendarRepairLogFileAgeLimit 14
Set-MailboxServer –identity Exchange01 –CalendarRepairLogDirectorySizeLimit 1GB

To troubleshoot individual Calendar issues...

Get-CalendarDiagnosticLog –identity “user one” –StartDate “12/12/2013” –EndDate “19/12/2013”
Get-CalendarDiagnosticLog –identity “user one” –Subject “Well Being Meeting”
Get-CalendarDiagnosticLog –identity “user one” –Subject “Well Being Meeting” | Get-CalendarDiagnosticAnalysis

By default, CalendarVersionStoreDisabled is set to $False. Hence, Calendar diagnostic logging is enabled.

Note: if you use subject as your Get-CalendarDiagnosticLog criteria, you must provide the exact string of the meeting subject.

No comments:

Post a Comment