Hello,
In the following, I list SiteName, Location, Subnets, and Severs, however I don't see all the servers or the subnets, presumably because Subnets are an ActiveDirectorySubnetColletion and Servers are a ReadOnlyDirectoryServerCollection. So I want to expand this property so I can see all the elements of the collection, or array. I've tried the Select-Object -ExpandProperty, but I get an error due to -ExpandProperty looking for a string.
Any suggestions on how to expand both the Subnet and Server collections so I can see all elements and I can export to a CSV file?
[cmdletbinding()] param() $MyArray = @() $Sites =[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites foreach ($Site in $Sites) { $obj = New-Object -Type PSObject -Property ( @{ "SiteName" = $Site.Name;"SiteLocation" = $Site.Location; "SubNets" = $Site.Subnets; "Servers" = $Site.Servers } ) $Obj | Sort $Site.Name | FL $MyArray += $obj } $MyArray | export-csv -path $env:HOMEPATH\SitesSubs.csv -NoTypeInformation
Thanks for your help! SdeDot