Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Thursday, July 21, 2011 3:32 PM
Hi,
Basically I need to provide a report of list of specific mailboxes including all users with access rights (read and read/write) to those mailboxes.
These mailboxes have nothing in common in terms of Display name/alias. So is there a way to just use a single cmdlet to specify all the mailboxes and display them all in the result? and can I pipe it with Get-MailboxPermission so that the result will have the Mailbox display name and the users' access rights to it and still readable when exported to csv?
Thanks,
John
Thursday, July 21, 2011 4:30 PM ✅Answered
The identity parameter of get-mailbox will work with wildcards, but not an arbitrary list. You'll need to do a foreach for that.
foreach ($mbx in (get-content c:\somedir\mailboxlist.txt)){get-mailbox $mbx}
As far as getting the perms in a format that's readable in csv, this is the closest I've got:
foreach $mbx in (get-content c:\somedir\mailboxlist.txt)){
get-mailboxpermission $mbx |
where{-not $_.isinherited} |
select identity, @{label="Permissions";expression={$_ | ft user,accessrights -auto -HideTableHeaders |
out-string}} |
export-csv c:\somedir\mailboxperms.csv
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Wednesday, August 5, 2015 5:12 PM ✅Answered
Pipe your get-mailboxpermission cmdlet inside the brackets. Like this:
foreach ($mbx in (get-content c:\somedir\mailboxlist.txt)){get-mailbox $mbx | Get-MailboxPermission -user <username>}
You can also do this for details:
foreach ($mbx in (get-content c:\somedir\mailboxlist.txt)){get-mailbox $mbx | Get-MailboxPermission -user <username> |FL}
Regards
Friday, July 29, 2011 9:58 PM
Thanks mjolinor!
The only problem I'm getting with this is it only gets the last mailbox in the notepad when exported to .csv.
It outputs in the EMS just fine, from the very first mailbox to the last. However, when export-csv is added, the .csv file contains only the last mailbox.
I'm not sure but could it be how I separated the mailboxes in the .txt? I did it one mailbox identity per line with no symbol whatsoever. How should they be separated? Semi-colon? enclosed within parenthesis? quotation marks?
Thanks a bunch,
John
Saturday, July 30, 2011 12:03 AM
one more thing. I added an open ( before the $mbx and included the export-csv in the closing } because if I put outside as a separate cmdlet, it gives me an error about empty pipe.