Solved

get-adgroupmember cmdlet is not working.

Posted on 2014-10-08
5
257 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
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…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

705 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