Export data from the notes field from multiple AD groups with powershell

Hi EE

I think I need to use the -ExpanProperty option here somewhere but I cant figure it out.. I need to export ALL the data in the notes
section for a list of AD groups .. but I can only get it to output the first line in the notes of the group .

can someone assist please ..

gc groups.txt | Get-ADGroup -Properties name,info | select name,info | Export-Csv GroupInfo.csv -NoTypeInformation
LVL 2
MilesLoganAsked:
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.

Rainer JeschorCommented:
Hi,

could you please try the following?
I assume that the notes property is simply a string array, therefore you have to join the single lines.
Sorry, I have currently no domain connectivity to test/verify:
gc groups.txt | Get-ADGroup -Properties name,info | select name,info,@{Name='Notes';Expression={[string]::join(" ", ($_.Notes)) | Export-Csv GroupInfo.csv -NoTypeInformation 

Open in new window


HTH
Rainer
0
MilesLoganAuthor Commented:
Hi Rainer , I could not figure out where its missing ..

Missing closing '}' in statement block.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingEndCurlyBrace
0
Rainer JeschorCommented:
Hi,
sorry - copy & replace error:
gc groups.txt | Get-ADGroup -Properties name,info,notes | select name,info,@{Name='Notes';Expression={[string]::join(" ", ($_.Notes))}} | Export-Csv GroupInfo.csv -NoTypeInformation 

Open in new window


There where two closing curly brackets missing.

Thanks.
Rainer
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
MilesLoganAuthor Commented:
Hi Rainer ... it outputs a notes column but not exactly what I need .

so the info attribute is the "notes" field in the AD group .. I need to be able to export all that data.
check out the screen shot , currently I can only get it to output to CSV the first line of data in the Notes field.
Capture.PNG
0
MilesLoganAuthor Commented:
Thanks Rainer .. from your assistance I modified it a tad and it worked .. thanks !


gc groups.txt | Get-ADGroup -Properties name,info | select name,@{Name='Info';Expression={[string]::join(" ", ($_.Info))}} | Export-Csv GroupsInfoFull.csv -NoTypeInformation
1
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.