Solved

get-adgroupmember cmdlet is not working.

Posted on 2014-10-08
5
232 Views
Last Modified: 2014-10-30
I am trying the get-adgroupmember to list members in a domain group but I am getting a message in powershell saying it is not a valid command.  

get-adgroupmember "domain admins" -recursive | ft names

Please advise.
0
Comment
Question by:nav2567
5 Comments
 
LVL 16

Expert Comment

by:Rajitha Chimmani
ID: 40369618
Have you imported the active directory module?

Import-Module ActiveDirectory
0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40369673
Raj is correct. If you are not doing this on a domain controller you have to make sure that you have the RSAT Tools installed to have the ActiveDirectory module available as well.

When adding features it is called "AD DS Snap-Ins and Command-Line Tools features"
0
 
LVL 2

Expert Comment

by:Crusadin
ID: 40372643
Try this:

$group = "Domain Admins"
$directorySearcher = New-Object System.DirectoryServices.DirectorySearcher([ADSI]"")
$directorySearcher.Filter = "(&(objectclass=group)(name=$group))"
$directorySearcher.FindAll() | %{$_.Properties.member} | %{([ADSI]([System.String]::Format("LDAP://{0}",$_))).Properties.name}


It doesn't require any snap in and is compatible with DC 2003
0
 

Author Comment

by:nav2567
ID: 40382310
I tried the following command but do not see any members being returned.  Please see the attached and advise.
getmember.png
0
 
LVL 16

Accepted Solution

by:
Joshua Grantom earned 500 total points
ID: 40382315
take the "s" off of names

get-adgroupmember "domain admins" -recursive | ft name

Open in new window

0

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now