Monday, July 23, 2007

Finding Virtual Servers in a domain

John Howard wrote an article of how to do it from vbscript. I couldn't resist doing it with PowerShell -

Get-VirtualServerFromAD.ps1 -



param([switch]$nameOnly)

$ds=[system.directoryservices.directorysearcher] "(&(objectCategory=serviceConnectionPoint)(cn=MS Virtual Server))"
$servers=$ds.findall()
if ($nameOnly) {
$servers | % { $_.path.split("=,")[3] }
}
else {
$servers
}



Could it be much easier?

Update: the software ate the vertical bars etc.

No comments: