question

MarkVerhunce-0269 avatar image
0 Votes"
MarkVerhunce-0269 asked RichMatheisen-8856 answered

PowerShell get-Mailbox for exchange permissions.

I am running Get-Mailbox -RecipientTypeDetails SharedMailbox |Get-MailboxPermission |Select-Object Identity, User, {$_.AccessRights}

This works great and gives me the info I need. However it provides me extra info that I am hoping to clean up and remove.

Issues:

  1. In the Identity column results I get widget.com/Widget/Widget1/Joe and widget.com/Widget/Widget2/Jane and I would like to trim this where I only get Joe and Jane in the identity column.

  2. In the user column I get NT Authority\Self and Domain\Domain admins along with other system accounts that I would like to filter out these results.

Any assistance is greatly appreciated



windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MarkVerhunce-0269 avatar image
0 Votes"
MarkVerhunce-0269 answered

I got it figured out.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered

That's some pretty basic PowerShell coding. I'd recommend you download this PDF: Windows-PowerShell-4. The download is free. Work through the 1st half of the book and do the exercises. When you feel more confident with PowerShell, work through the 2nd half of the book which covers performing common administrative tasks.

To get the "Joe"/"Jane" stuff: ("widget.com/Widget/Widget1/Joe" -split "/")[-1]

To see if a value you define should be excluded:

 $exclude = "NT Authority\Self","Domain\Domain admins"
 $user = "NT Authority\Self"
 if ($exclude -contains $user){"$user excluded"}




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.