I want to get a list of all permissions for a specified list of mailboxes.
To get all permissions for just one, I can do this:
Get-MailboxPermission -Identity "Mailbox01"
What if I wanted to get a list of permissions for more than one mailbox at a time?
Something like:
Get-MailboxPermission -Identity "Mailbox01","Mailbox02","Mailbox03"
How could I do something like that - in one list?
something like this should work:
"Mailbox01","Mailbox02","Mailbox03" | % { Get-MailboxPermission -Identity $_ }
Have to use a foreach because Get-MailboxPermission
doesn't accept [string[]]
as pipeline input or you can do:
"Mailbox01","Mailbox02","Mailbox03" | get-mailbox | Get-MailboxPermission
Brian T Grant
You should first pull a list of the mailboxes needed and pipe into a variable or paste into a .CSV file (I prefer CSV files). Example:
Get-Mailbox -resultsize unlimited | Where-Object {$_.RecipientType -like "UserMailbox"} | select userprincipalname, ForwardingAddress |out-gridview
$CSV = import-csv "c:\CSV.csv"
$CSV |out-gridview
$CSV | foreach {get-MailboxPermission -identity $_.userprincipalname} |out-gridview
with the Gridview you can then further sort on multiple values
来源:https://stackoverflow.com/questions/18210923/get-mailboxpermission-for-list-of-mailboxes