Solved

Enumerate members of an Active Directory group

Posted on 2008-10-09
3
483 Views
Last Modified: 2008-10-10
I have a domain named xxx, an ou named yyy, and need to list the members of zzz group. What is the best way to do this? Thanks!!
0
Comment
Question by:dltuschl
3 Comments
 
LVL 71

Accepted Solution

by:
Chris Dent earned 150 total points
ID: 22677974

It really depends on what you're looking to see.

This may be enough for you:

dsquery group -samid "Domain Admins" | dsget group -members -expand | dsget user -display

That will find the Domain Admins group and list all of the members display names.

Chris
0
 
LVL 33

Assisted Solution

by:MikeKane
MikeKane earned 50 total points
ID: 22678327
This is VBS code that will dump the groupmembers from a group.     It was in my library of sample code but I don't know where I originally got it otherwise I'd credit the author....  

Basically save the script as 'listusers.vbs'
Then run
CSCRIPT listusers.vbs <groupname>

On Error Resume Next
Dim objGrp, colArgs, objNetwork,objShell
Set objShell=CreateObject("wscript.shell")
set objNetwork=CreateObject("WScript.Network")
set colArgs=wscript.Arguments
 
'you can pass a group name as a parameter, otherwise you will be prompted.
if colArgs(0)="" then
 strGrpName=InputBox("Enter the name of the group to dump.  You quotes around names with spaces.",_
 "Group Info",CHR(34) & "Domain Admins" & Chr(34))
 else
strGrpName = colArgs(0)
end If
 
Set objGrp = GetObject("WinNT://" & objNetwork.UserDomain & "/" & strGrpName & ",group")
 if Err.Number <0 Then
  wscript.echo "Failed to connect to " & objNetwork.UserDomain & " or find group " & UCASE(strGrpName)
  wscript.echo "Error #"&err.number
  wscript.echo "Error Description (if available): " & err.description
  set objGrp=Nothing
  wscript.quit
 end If
icount=0
set memberlist=objGrp.Members
for each member in memberlist
'display member name and class, such as user or computer
  wscript.echo member.Name & "," & member.Class 
  icount=icount+1
Next
 
strMsg="Counted " & icount & " members of " & objNetwork.UserDomain & "\" & strGrpName
objShell.Popup strMsg,10,"Group Info",0+64
 
wscript.quit
 
'EOF

Open in new window

0
 
LVL 23

Assisted Solution

by:Malli Boppe
Malli Boppe earned 50 total points
ID: 22684162
net group GroupName /domain
run this command on a DC donot replace domain with doamin name.

http://windowsitpro.com/article/articleid/93883/how-can-i-use-a-command-to-list-all-the-members-of-an-active-directory-ad-group.html
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read https://technet.microsoft.com/en-us/windows-server-docs/security/securing-privileged-access/s…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question