Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
One of the advantages of having Virtualization integrated with Windows is that the Hyper-V (and in fact Virtual Server 2005) registers itself in active directory so you can discover your servers easily - quite useful if servers start popping up like mushrooms.
John Howard has been tracking the number of registered servers on the Microsoft corporate network for a while now, and he shared his VB script internally a little while ago, and has now posted it on his blog,
I've reworked it to run in PowerShell, and I got a shock when I found how many machines in my Domain were running HyperV. Lots
function get-vmHosts
{param ($domain=([adsi]('GC://'+([adsi]'LDAP://RootDse').RootDomainNamingContext)))
$searcher= New-Object directoryServices.DirectorySearcher($domain)
$searcher.filter="(&(cn=Microsoft hyper-v)(objectCategory=serviceConnectionPoint))"
$searcher.Findall() | foreach {$_.path.split(",")[1].replace("CN=","")}
} #Example get-vmhosts "DC=ite,DC=contoso,DC=com" | foreach {$_; list-vmstate -server $_}
# Queries the domain ITE.Contoso.com for Hyper-V servers,
# prints the name of each and dumps the state of VMs on each
I've added this to the latest drop of my Hyper-V library which I will post to CodePlex towards the end of this week.