Link to home
Start Free TrialLog in
Avatar of SAM2009
SAM2009Flag for Canada

asked on

How to filter result in PowerShell

I run this cmd but need to filter user result:

Get-MailboxPermission -Identity "UserMydomain.com" | ft User, AccessRights

Fo example I don't want to see users contain: "S-1-5-21" or "Domain Admins" or "Exchange Servers"

How can I do that?

Thanks
SOLUTION
Avatar of Jason Crawford
Jason Crawford
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SAM2009

ASKER

A lot better but in Identity column how can I get the whole info?

Because i got something like this with 3 dots at the end: Shared Mailbox/Lab...
Well you have several options:

$perms = Get-MailboxPermission john.doe| Where-Object {$_.isinherited -eq $false}

$perms.Identity

Open in new window

(Get-MailboxPermission john.doe | Where-Object {$_.IsInherited -eq $false}).identity

Open in new window

Get-MailboxPermission john.doe | Where-Object {$_.IsInherited -eq $false} | Select-Object -ExpandProperty Identity

Open in new window

To name a few.
Avatar of SAM2009

ASKER

But I want to keep the same info  and result format as you suggest in the first answer: User,AccessRights,Identity,IsInherited
Get-MailboxPermission –identity * | fl user, identity, accessrights

Following article contains more options for this command

https://blogs.msdn.microsoft.com/deva/2012/04/15/exchange-server-2007-2010-how-to-query-user-mailboxes-its-permissions-using-exchange-powershell/
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SAM2009

ASKER

Thanks for the explanations.

In my case the Identity names are all in one line even with Identity.Name. Is there a way to have it separately at least?
Avatar of oBdA
oBdA

Sorry, can't follow you.
Your example retrieves the mailbox permissions for one mailbox with the identity "UserMydomain.com". This is one single identity, and accordingly, there should be one single identity for each ACE listed.
I'm not really an Exchange administrator, and I can't reproduce "Identity names are all in one line even with Identity.Name". You need to elaborate here on the actual command you're using and its output.
Avatar of SAM2009

ASKER

I have enough info to continu. Thanks to all!