View Mailbox Folder permissions for whole OU
Hi Folks,
Bit of a complex one, but I need help on this, I've done something similar in the past but my brain isn't working today
I'm looking to output a list of every folder in every mailbox that a user has permissions to (or alternatively, who has permissions to each folder) within an OU.
I've a script set aside that will show permissions to every mailbox and this works rather well (apart from the amount of excess data, like implicitly stating that exchange admins have access to every mailbox, which I can trim with a Macro in word or exel
if need be), but in the case of permissions given specifically to folders (such as calendars) this doesn't show. I've previously used (but since misplaced) a script that could output the results of every Calendar, but not every folder in turn.
Essentially, what I'd like as an output is:
<Mailbox name or SMTP address or Alias>
:\Inbox
List of Users with access to <mailbox>:\inbox
:\Sent
List of Users with access to <mailbox>:\Sent
:\Calendar
List of Users with access to <mailbox>:\Calendar
:\Contacts
List of Users with access to <mailbox>:\Contacts
For every user in an OU, exported in some semi-presentable form
Here's what I'm using to view who has permissions to a mailbox.
$AllUsers = get-mailbox -organizationalunit "ou=OU,dc=DC,dc=DC" | select alias
ForEach ($User in $AllUsers) {
$Mailbox = $User.alias
$Text0 = "---"
$Text1 = ""
$Text2 = "AccessRights For Mailbox: "+ $User +""
$Text3 = ""
$Text4 = "---"
$Text5 = ""
$Text0 | Out-File c:\mailboxbc_Permissions.txt -append
$Text1 | Out-File c:\mailboxbc_Permissions.txt -append
$Text2 | Out-File c:\mailboxbc_Permissions.txt -append
$Text3 | Out-File c:\mailboxbc_Permissions.txt -append
$Text4 | Out-File c:\mailboxbc_Permissions.txt -append
get-mailboxfolderpermission -identity $Mailbox | Select User, AccessRights | Out-File c:\mailboxbc_Permissions.txt -append
$Text5 | Out-File c:\mailboxbc_Permissions.txt -append
}
September 4th, 2012 6:41am