• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

get-adgroupmember cmdlet is not working.

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
nav2567
Asked:
nav2567
1 Solution
 
Rajitha ChimmaniCommented:
Have you imported the active directory module?

Import-Module ActiveDirectory
0
 
Joshua GrantomSenior EngineerCommented:
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
 
CrusadinCommented:
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
 
nav2567Author Commented:
I tried the following command but do not see any members being returned.  Please see the attached and advise.
getmember.png
0
 
Joshua GrantomSenior EngineerCommented:
take the "s" off of names

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

Open in new window

0

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now