Solved

get-adgroupmember cmdlet is not working.

Posted on 2014-10-08
5
237 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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Synchronize a new Active Directory domain with an existing Office 365 tenant
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 …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

772 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