Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Simple Script to Create CSV File of AD group members

$
0
0

 

Hello All i am working on a simple script that will export the contents of an AD group with a couple properties so the groups users can be imported into a new domain i just stood up. Here is the code i have so far:

Example:

Get-ADGroupMember -Identity Administrators | Select-Object Name,SamAccountName,Surname | Export-Csv GroupMembers.csv

 

In my output i get:

 

#TYPE Selected.Microsoft.ActiveDirectory.Management.ADPrincipal
NameSamAccountNameSurname
Domain AdminsDomain AdminsMicrosoft.ActiveDirectory.Management.ADPropertyValueCollection
Enterprise AdminsEnterprise AdminsMicrosoft.ActiveDirectory.Management.ADPropertyValueCollection
AdministratorAdministratorMicrosoft.ActiveDirectory.Management.ADPropertyValueCollection

I am not quite sure how i export the multi-valued attribute. Any help would be appreciated.


Viewing all articles
Browse latest Browse all 6937

Trending Articles