Get-mailbox permission

johnmerrick99
johnmerrick99 used Ask the Experts™
on
Experts -

Trying to get something going to get permissions for mailboxes for our IT Team and nothing I'm doing to get the results is working. Please assist.

Get-Mailbox -server1, server 2, | Get-MailboxPermission -User user1, user2, user3

Practically that's what I need as seen above.
get to query our couple mailbox servers and then get what mailbox permissions user1-user3 have.
I want to be able to export this report to a share and send an email letting users1-3 that the report is ready

Please assist when you have a moment.

Thanks
JohnM
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
"Batchelor", Developer and EE Topic Advisor
Top Expert 2015
Commented:
You cannot use more than one user as parameter for Get-MailboxPermission, and the Get-Mailbox syntax is incorrect too (same reason and typos).
If you have to process several servers and users you'll have to loop thru both. E.g. with
$(
  foreach ($server in 'server1', 'server2')
  {
    Get-Mailbox -server $server |
    % {
      $mb = $_ 
      'user1', 'user2' | Get-MailboxPermission -identity $mb.identity -user $_ 
   }
)

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial