Monday, August 16, 2010

List Group Members in Active Directory–PowerShell Script

Updated Script - http://portal.sivarajan.com/2011/10/search-ad-collect-local-admin-group.html

This script can be used to list group membership in Active Directory.

image

As you can see on the following screenshot, this script uses an input file called Glist.csv which contains all group names.

image

You will see the output on the screen as well as in the GroupDetails.csv file.

image

You can download the script from the following locations.  Rename the file to .PS1

http://www.sivarajan.com/scripts/Group_Members.txt

http://gallery.technet.microsoft.com/scriptcenter/dcc9432e-d541-4be2-a39c-637c8d4c9fd0


Modified Script – This script will prompt you for the Group distinguishedName (DN). 

image


4 comments:

Hi Santosh,

Do you have any disc.vouchers for MCTS 70-432 now? iam planning to finish it off this weekend.

Regards,
Vinodh
Chennai,India

Could you elaborate on the contents of Glist.csv? I have an AD with no OUs created and I am not sure what to put there.

Also, does the DC=local indicate the script is run on the DC? Should I put something else to run it remotely?

It is the DN (Distinguished Name) of the group. If you have Windows 2008 or R2, you can go to the properties of the group and select the “Attribute” Tab, you will see the Distinguished Name (DN) there.

DC is the domain name. In my example, my domain name is “Infralab.local”

“Test1” is the group name. It is inside the “Test” OU.

So the DN of the Group = “name of the group, name of OU, domain name”

http://msdn.microsoft.com/en-us/library/windows/desktop/aa366101(v=vs.85).aspx

http://technet.microsoft.com/en-us/library/cc776019(WS.10).aspx

Please let me know if you need more clarification.

Post a Comment

Popular Posts

Sociable

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More