A while back, my boss came to me, asking me if I could get him an export of the users that are members of two groups in Active Directory. For the purposes of this blog post, let’s call them “OfflineUsers” and “Software Access”. As it turns out, this is pretty easy to do. Here’s how:
-
- Log on to your Domain Controller
- Open a command prompt
- Enter the command
dsquery group -samid %GROUPNAME% | dsget group -members > filename.txt
, substituting %GROUPNAME% for the name of the group, and replacing filename with something logical if you so desire:
- Go to the folder from which you run the command, and grab the text files
A few things to remember here:
- You must enclose group names with spaces in quotes, like so:
"Software Access"
- You can specify what folder to store the file in, like so:
> C:%GROUPNAME%.txt
By posting a comment, you consent to our collecting the information you enter. See privacy policy for more information.