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

Hi,

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 
again.
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
Sascha
Sa5chaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SubsunCommented:
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

0
Sa5chaAuthor Commented:
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

0
SubsunCommented:
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..

http://technet.microsoft.com/en-us/library/dd391908%28WS.10%29.aspx

http://blogs.technet.com/b/ashleymcglone/archive/2011/03/17/step-by-step-how-to-use-active-directory-powershell-cmdlets-against-2003-domain-controllers.aspx

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..

Http://www.quest.com/powershell/activeroles-server.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sa5chaAuthor Commented:
Thanks this give me the hints I needed
Sascha
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.