PSCustomObject with ADPropertyValueCollection.

Not sure if it can work this way or not, it’s what I’ve cobbled together from Googling.

$computers = Get-ADComputer -Filter * -Properties MemberOf ForEach ($computer in $computers) { [PSCustomObject]@{ Computer = $computer.name Groups = $computer | Select -ExpandProperty $computer.memberof } } 

Returning “Cannot convert ADPropertyValueCollection to System.String” error.

submitted by /u/bsnotreallyworking
[link] [comments]

Leave a Reply