Avatar of Simon336697
Simon336697
Flag for Australia

asked on 

Getting just the samid for each account not the full DN path

Hi guys, hope you are all well.

Guys I have a command that generates the following:

dsquery group "CN=AU-SG SYD_tester,OU=GlobalGroups,OU=Groups,DC=au,DC=test,DC=electric,DC=com" | dsget group -members


"CN=sjones,OU=MEL,OU=Combined,OU=AllSites,DC=au,DC=test,DC=electric,DC=com"
"CN=psimms1,OU=SYD,OU=Combined,OU=AllSites,DC=au,DC=test,DC=electric,DC=com"

What I am trying to do is to find all members of the provided group.

Although at present it works, Im not happy with the fact that the output for each user is showing the FULL DN path to each user. Instead of this, Id rather just the samaccountid as follows:

dsquery group "CN=AU-SG SYD_tester,OU=GlobalGroups,OU=Groups,DC=au,DC=test,DC=electric,DC=com" | dsget group -members

sjones
psimms1

Any help on how I would modify my command to do this would be greatly appreciated.

Visual Basic.NETWindows Batch

Avatar of undefined
Last Comment
Simon336697

8/22/2022 - Mon