Avatar of Jay Thomas
Jay Thomas
Flag for United Kingdom of Great Britain and Northern Ireland asked on

AD 2003 list group members

HI all,

probably a no brainer this one. I need to know how to get a list of users from a domain based group. Preferably one which does not include the entire distiguished name for each user as I need to send the list of users to onother department.

Many thanks
Windows Server 2003Active Directory

Avatar of undefined
Last Comment
Krzysztof Pytko

8/22/2022 - Mon
Krzysztof Pytko

Try with DSTools on a DC in command-line

dsquery group -name "GroupName" | dsget group -members -expand | dsget user -samid -fn -ln -display -desc >>c:\users.txt

Open in new window


EDIT: are you able to install Quest PowerShell module for AD (it's free)?
http://www.quest.com/powershell/activeroles-server.aspx

then you can use this syntax:

Get-QADGroup "GroupName" | Get-QADGroupMember -Indirect | Get-QADUser | Select SamAccountName,givenName,sn,Decription | Export-CSV c:\users.csv

Open in new window


Regards,
Krzysztof
Jay Thomas

ASKER
Hi, can you explain the fn and ln switches please? Also, probably being dumb but where do i specify the OU?
Jay Thomas

ASKER
Hi Krzysztof. Would that need to be installed on a DC? If so I'd never get it signed off in the time that i need the results but thanks anyway.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Prashant Girennavar

Question : Hi, can you explain the fn and ln switches please? Also, probably being dumb but where do i specify the OU?

   fn= First name
   ln= Last name

You need to specify any OU path, As Group name is sufficient to query the AD
Krzysztof Pytko

fn attribute means First Name
ln attribute means Last Name

you don't have to specify OU because you need to only provide GroupName in a syntax and it will be discovered. Then all group members you will get into text file on C-Drive.

When you have DC then you don't have to install anything, DSTools are available. You need to only install RSAT/Administrative Tools on local workstation to use DS commands.

Quest tool you can install on any workstation and then use it

Krzysztof
Prashant Girennavar

Would that need to be installed on a DC? If so I'd never get it signed off in the time that i need the results but thanks anyway.?

 Dsquery is Inbuilt tool No need to install on DC.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Jay Thomas

ASKER
Hi, when i run the dsquery i get an error:

deget failed: value for "target object for this command" has incorrect format

Mean anything. I've tried group name with and without quotes but same error. Didn't know if quotes were required.
SOLUTION
Krzysztof Pytko

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Jay Thomas

ASKER
HI, running the new query just creates a blank document. There is a microsft header but the last line says "no files specified"
Krzysztof Pytko

Have you replaced "GroupName" with your own group name to query ?

Krzysztof
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Jay Thomas

ASKER
Yep. HAve included qotes but no change, same output blank file.
Krzysztof Pytko

Type command without redirection to file and see what do you see on the screen

dsquery group -name "GroupName" | dsget group -members -expand

Open in new window


or skip -expand switch which may cause this error

dsquery group -name "GroupName" | dsget group -members >>c:\users.txt

Open in new window


however, I would recommend using for that Quest PowerShell :)

Krzysztof
Jay Thomas

ASKER
Forget that, Had an extra | in there for good measure :)   That has worked except I have some 1500 users each showing distinguished name.

Back to the POwershell. Does this need installing on a DC?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Jay Thomas

ASKER
Thank you very much guy's. Hope that teh points split seems fair.
Krzysztof Pytko

You're welcome :)

Krzysztof