List members of a AD group

Product:
Cognos Controller 10.1
Windows 2008 Server

Problem:
How do I list all the members that are part of a Microsoft Active Directory group ?

Solution:
Log on to a Microsoft Windows 2008 server in the domain.
Start a CMD prompt
Create a temp folder
Go to the temp folder
Enter following command to get a list of users in a AD group:

dsquery group -domain EU -samid citrix_app_cognoscontroller | dsget group -members > cognoscontrollerusers.txt

Replace above EU with your domain name
Replace above citrix_app_cognoscontroller with the AD group you want to list
Replace above cognoscontrollerusers.txt with the name of the text file you want created.

The file is crated in the temp folder, you are standing inside.

To find out if a group exist in your domain you can enter:
dsquery group -samid citrix_app_cognoscontroller

If the group exist in the domain you are, it will print the CN string in AD for that group.

To find out what groups a user are member of you can enter:
dsquery user -samid roger | dsget user -memberof -expand

This will list all Active Domain groups the user “roger” is part of.
Replace above roger with the username you want to check.