Link to home
Start Free TrialLog in
Avatar of networkbike
networkbike

asked on

PowerShell command to removed unwanted info from an output

When I run the script: Get-MailboxPermission 'Joe Bloggs' | Select User,AccessRights | ft -autosize
I get an output that included a lot of default users such as: Domain Admins, Enterprise Admins, Exchange Domain Servers, Exchange Services etc

How could the list produced be reduced to just normal users. Something like  Where-Object {$_.name  -NotLike "*Admin"} may work. How would the script look that removed the line containing *Admin* or remove -Like '*Exchange*'. There are also quite a few SIDs being displayed as will so any entry with 'S-1-5' needs to be removed.

The attached text file are the ones I need to go away in the output.
Avatar of Jason Crawford
Jason Crawford
Flag of United States of America image

Try this:

Get-MailboxPermission 'Joe Bloggs' | Where-Object {$_.IsInherited -eq $false} | Select User,AccessRights | ft -autosize

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of networkbike
networkbike

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 networkbike
networkbike

ASKER

Looked at some other scripts which had something similar.