This topic contains 4 replies, has 4 voices, and was last updated by
May 15, 2019 at 4:08 pm #156707ParticipantTopics: 6Replies: 5Points: 48Rank: Member
I have the following script to output member of an AD group:
Get-ADGroupMember -identity "Group Name" -Recursive | select Name, objectclass, SamAccountName
The output is displayed as tab delimited. I'd like to make it comma delimited.
May 15, 2019 at 4:13 pm #156711ParticipantTopics: 1Replies: 1333Points: 1,690Rank: Community Hero
That's anyway just the output of the console. If you want to have it in a file you should use Export-Csv. Please read the complete help including the examples to learn how to use it.
May 16, 2019 at 11:58 am #156878ParticipantTopics: 6Replies: 5Points: 48Rank: Member
Yep, that was what I was looking for.
Here's what I have:
Get-ADGroupMember -identity "GroupName" -Recursive | select Name, objectclass, SamAccountName | Export-Csv -Path 'c:\temp\pbi_ad_groupname.csv' -Delimiter "," -NoTypeInformation
Thanks for your help!
May 15, 2019 at 5:37 pm #156723ParticipantTopics: 0Replies: 34Points: 308Rank: Contributor
You should be able to use -join for this. You'll want to decide what property you want delimited. I chose Name.
$groups = Get-ADGroupMember -identity "Group Name" -Recursive | select Name, objectclass, SamAccountName $groups.Name -join ','
May 15, 2019 at 7:28 pm #156741ParticipantTopics: 2Replies: 438Points: 882Rank: Major Contributor
It sounds like you're asking for a CSV file, in which case Olaf's suggestion is one of the most effective. Also worth noting that if you don't want to create a file and just want to convert it to CSV in the console there is also a
You must be logged in to reply to this topic.