1

I am trying to get a list of groups that will include MembersOf and Members. however when I export the CSV I get: Microsoft.ActiveDirectory.Management.ADPropertyValueCollection.

How can I make it give me the SAMAccount names in those colums?

Here is my script as it is now.

$results = foreach ($OU in $OUs) { 
Get-ADGroup -SearchBase $OU -Filter * -Properties SamAccountName,CanonicalName,Created,Description,ManagedBy,Member,MemberOf,Members,ObjectGUID,whenChanged|
? {$_.CanonicalName -NotLike "*Terminated*" -and $_.CanonicalName -NotLike "*legal hold*"}
}
$results | select SamAccountName,CanonicalName,ManagedBy,MemberOf,Members,Created,Description |
Export-Csv \\####\####\####\####\####\AllGroups.csv -NoTypeInformation
mklement0
  • 382,024
  • 64
  • 607
  • 775
BPengu
  • 92
  • 8
  • I hope that the linked post contains a helpful explanation and that you can adapt the example there to your use case; let us know if not. – mklement0 Jan 27 '20 at 18:39

0 Answers0