The term 'get-adgroupmember' is not recognized ...

Posted on 2013-09-20
Medium Priority
Last Modified: 2013-09-20

I am a complete Poweshell Newbie,  may someone please help me with this ?

I have to export all members of a certain AD group into a csv File, this ps-statement should  do the job:

C:\Users\xyz> Get-ADGroupMember "Accounts" |  ft name,samaccountname | Export-Csv "C:\GroupMembers.csv"

Open in new window

But I just get that as an error :

The term 'C:\Users\xyz>' is not recognized as the name of a cmdlet, function, script file, 
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try 
At line:1 char:1
+ C:\Users\xyz> Get-ADGroupMember "Accounts" |  ft name,samaccountname | Ex ...
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\xyz>:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException 

Open in new window

It seem that I need to install some more components to access ad objects ?

Thanks in Advance
Question by:Sa5cha
  • 2
  • 2
LVL 40

Expert Comment

ID: 39508896
Hope you have a windows 2008 R2 domain controller.. If yes... run the following command to import the AD module.. and after importing module you will be able to run Get-ADGroupMember..
import-module activedirectory

Open in new window

Also to export the result to csv..
Get-ADGroupMember "Accounts" | Select name,samaccountname | Export-Csv "C:\GroupMembers.csv"

Open in new window


Author Comment

ID: 39508927
Nope, our domain controller is Win2003, so there is no chance to access it via ps ?

Thank you for your fast reply.

I got the following error:

PS C:\Users\xyz> import-module activedirectory
import-module : The specified module 'activedirectory' was not loaded because no valid module file was found in any 
module directory.
At line:1 char:1
+ import-module activedirectory
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (activedirectory:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Open in new window

LVL 40

Accepted Solution

Subsun earned 2000 total points
ID: 39508961
YOu need windows 2008 R2 or later DC to use the MS AD cmdlets, To use the AD cmdlets on windows 2003 you need the Active Directory Management Gateway Service. Refer the following articles for details..



Or you can use quest ad module, which is very easy to install... You can install it on any computer which is connected to your domain and run the commands..


Author Closing Comment

ID: 39509069
Thanks this give me the hints I needed

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

You have missed a phone call. The number looks like it belongs to the bunch of numbers which your company uses. How to find out who has just called you?
After a recent Outlook migration from a 2007 to 2010 environment, some issues with Distribution List owners were realized. In this article, I explain how that was rectified.
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 transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

624 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