Hi guys,
This is my script to get all mailbox permissions for all shared mailboxes from a specific mailbox store:
Get-Mailbox -Database MailboxstoreXX | Get-MailboxPermission | Where-Object {$_.user.tostring() -ne "NT AUTHORITY\SELF" -and $_.user.tostring() -ne "Domain\UserToFilter" -and $_.user.tostring() -ne "S-1-5*" -and $_.IsInherited -eq $false} | Select-Object User,Identity,@{Name='Access Rights';Expression={[string]::join(', ', $_.AccessRights)}} | Export-Csv -NoTypeInformation -Path "C:\PathToFolder\permissions.csv"
This is a generic code that you could edit for your needs.
The issue that I have:
When executing this on the Exchange server in the Exchange Management Shell I get a nice result in CSV format.
Access rights are shown in the format: FullAccess, DeleteItem, ReadPermission
I like to run all my scripts in the ISE editor with a PSSession to Exchange.
The script works as well, but instead of the correct access rights I receive this:
System.Collections.ArrayList
So basically, in the ISE editor, the ArrayList is not converted to a string.
Does anybody have an idea how to fix this in the ISE editor?
Or why it is working on the Exchange server but not locally?
Perhaps there is an easier way?
Thank you