I am trying to output the members of an AD group in an easy to read format with the following:
dsquery group -name "<AD GROUP NAME>" | dsget group -members -expand | dsget user -samid -fn -ln
If I just do dsquery group -name "<AD GROUP NAME>" | dsget group -members -expand
I can see some of the accounts have CN=ForeignSecurityPrincipals
- how do I exclude those from the output?
Just add the following at the end of your commando.
|find /v "CN=ForeignSecurityPrincipals"