Monday, July 30, 2012

powershell script to get a list of all members in a Security Group in a Windows 2008 R2 Domain


PS C:\Users\> get-adgroupmember "CN=testgroups,OU=Groups,OU=All Groups,DC=Contesso,DC=com,DC=au""  | get-aduser -properties cn,name,mail,enabled |select cn
,name,mail,enabled | export-csv C:\temp\pstest5.csv


This is the powershell version of the DSGet query posted earlier with output directed to a csv file.

No comments: