MilesLogan
asked on
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
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
ASKER
Hi Rainer , I could not figure out where its missing ..
Missing closing '}' in statement block.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordE xception
+ FullyQualifiedErrorId : MissingEndCurlyBrace
Missing closing '}' in statement block.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordE
+ FullyQualifiedErrorId : MissingEndCurlyBrace
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
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
ASKER
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';Express ion={[stri ng]::join( " ", ($_.Info))}} | Export-Csv GroupsInfoFull.csv -NoTypeInformation
gc groups.txt | Get-ADGroup -Properties name,info | select name,@{Name='Info';Express
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:
Open in new window
HTH
Rainer