ACtive Directory security Group

Dear Experts,

I can export and import active directory users using csvde utility. But my Organization wants export and import the security group of ROLES OU Under Test OU.along with members associated with that group. Please find the att20151115_222509.jpgaches snap for reference .
20151115_222509.jpg
20151115_222509.jpg
LVL 1
JJ KRWindows System administratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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

Benjamin VoglarIT ProCommented:
you can export group mambers with powershell:

Get-ADGroupMember -identity “Name of Group” | select name | Export-csv -path C:\Output\Groupmembers.csv
Will SzymkowskiSenior Solution ArchitectCommented:
Just use powershell for this. See below..
Get-ADGroup -Filter * -searchbase "ou=roles,ou=test,dc=cb,dc=gov.dc=qa" | 
Get-ADGroupMember | 
Select @{n=GroupName';e={ (get-adgroup -identity $_) } }, Name
 

Open in new window


The script above will get all of the groups in the OU and show all of the members for each group it finds.

Will.
JJ KRWindows System administratorAuthor Commented:
Hi,

Thanks for the comments i git this error while executing

PS C:\> Get-ADGroupMember -identity "ADMIN" | select name | Export-csv -path C:\Output\Groupmembers.csv
The term 'Get-ADGroupMember' is not recognized as the name of a cmdlet, function, script file, or operable program. Che
ck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:18
+ Get-ADGroupMember <<<<  -identity "ADMIN" | select name | Export-csv -path C:\Output\Groupmembers.csv
    + CategoryInfo          : ObjectNotFound: (Get-ADGroupMember:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Benjamin VoglarIT ProCommented:
Go on Domain Controler and run powershell with modules
Benjamin VoglarIT ProCommented:
Or run powershell and run this command first:

Import-Module ActiveDirectory
Will SzymkowskiSenior Solution ArchitectCommented:
Yes you need to have the activedirectory module imported first before running the script.

Will.
JJ KRWindows System administratorAuthor Commented:
Thanks Benjamin Voglar and thanks wills I will test and let you know.
JJ KRWindows System administratorAuthor Commented:
HI Benjamin Voglar,

I ran the command as instructed by you and the csv file generated without any records. Output.csv 0KB

PS C:\Users\Administrator>  Get-ADGroupMember -identity "ADMIN" | select name | Export-csv -path C:\Output\Groupmembers.
JJ KRWindows System administratorAuthor Commented:
Dear Will Szymkowski,
I ran the command as per your instruction but no results.
PS C:\Users\Administrator> Import-Module ActiveDirectory
PS C:\Users\Administrator> Get-ADGroup -Filter * -searchbase "ou=roles,ou=test,dc=cb,dc=gov.dc=qa" |
>>
Will SzymkowskiSenior Solution ArchitectCommented:
You need to copy the entrie script. It looks like you only copied part of the script. Copy all of the script and paste it into a txt file and save the file with a .PS1 file extension.

I have tested this and it get all of the results exactly how you want them.

Will.

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
JJ KRWindows System administratorAuthor Commented:
Hi , I ran this script
 Get-ADGroup -Filter * -searchbase "ou=roles,ou=test,dc=cb,dc=gov.dc=qa" |
Get-ADGroupMember |
Select @{n=GroupName';C={ (get-adgroup -identity $_) } }, Name
 
And getting this error

The string starting:
At C:\Users\Administrator\Desktop\script.ps1:3 char:21
+ Select @{n=GroupName <<<< ';C={ (get-adgroup -identity $_) } }, Name
is missing the terminator: '.
At C:\Users\Administrator\Desktop\script.ps1:5 char:1
+  <<<<
    + CategoryInfo          : ParserError: (;C={ (get-adgro... } }, Name

:String) [], ParseException
    + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
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
Active Directory

From novice to tech pro — start learning today.