这可能吗?我需要从转换System.DirectoryServices.PropertyValueCollection
为String
.
IE
$ou = [ADSI]"LDAP://OU=Domain Controllers,DC=domain,DC=local"
foreach ($child in $ou.psbase.Children) {
if ($child.ObjectCategory -like '*computer*') {
Write-Host $child.Name
if (Test-Connection -quiet $child.Name) {
Test-Connection $child.name
Invoke-GPUpdate $child.name
}else{Write-Host "$child.Name is offline"}
}
}