Search This Blog

Thursday 15 October 2015

Getting folder permissions in a multi language environment

I have recently been working with a customer to audit their mailbox delegate permissions ready for a migration to Office 365.  This is because mailbox delegation/permissions don't work cross premises, i.e. the delegates and mailbox owners need to be all on-premise or all in O365.


Scenario

My issue was that this customer has a worldwide presence, and as such the users' mailboxes use a variety of languages.  This causes an issue as get-mailboxfolderpermissions requires the local language version of the folder in order to query permissions, e.g. get-mailboxfolderpermissions "usera:\calendario" to get a Spanish user's calendar permissions.

The usual way around this, which you will find plenty of hits for with your search engine of choice, is to use get-mailboxfolderstatistics to work out the local language name for the folder and then query get-mailboxfolderpermissions with that folder name.  Example code:

$Calendarfolder = $Mailbox.Name + ':\' + [string](Get-MailboxFolderStatistics $Mailbox.Identity | where-object {$_.foldertype -eq "calendar"}).Name 
# Get the permissions on the calendar $CalendarPermissions = Get-MailboxFolderPermission $Calendarfolder
This works really well if all your servers are running the same version of Exchange, albeit rather slowly due to the time taken to execute get-mailboxfolderstatistics. However, the get-mailboxfolderstatistics command can only query mailboxes that match the version of Exchange Server running the command.  Therefore if you run the command on Exchange 2013 against a 2010 mailbox you will get the dreaded wall of red:

>Unable to retrieve mailbox folder statistics for mailbox USERA. Failure: Error code -2146233088 occurred with message The mailbox of user usera@domain.com that is located on a server that is running version 14 can't be opened on a server that is running version 15.. + CategoryInfo : ReadError: (:) [Get-MailboxFolderStatistics], MailboxFolderStatisticsException + FullyQualifiedErrorId : [Server=EXCHANGE-01,RequestId=5787b9cf-9158-4dc4-a1cf-d7b63dd93ca8,TimeStamp=15/10/2015 13:59:37] [FailureCategory=Cmdlet-MailboxFolderStatisticsException] 147CD831,Microsoft.Exchange.Management.Tasks.GetMailboxFolderStatistics + PSComputerName        : exchange-01.domain.com