Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Combine results of two commands into a CSV

$
0
0

Hi guys,

I need to export group membership information into a CSV.
So far I have the following which is not working...

$ADGroups = Get-Content "Groups.txt"

ForEach ( $ADGroup in $ADGroups ) { 

Get-ADGroupMember $ADGroup | Select-Object @{Name="FullName";Expression={(Get-ADGroupMember $_).Name}} | Export-Csv Test.csv - NoType

}

The information I need in the CSV is GroupName($ADGroup), Name, SAMAccountName and DistinguishedName. Plenty of people asking about this on the internet but I am failing hard so hoping a fresh pair of eyes can highlight my downfall!

Thanks,


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>