Paradise228
Paradise228

Reputation: 717

List all Virtual Machines of a server on the Active Directory

I'm trying to list all the hyper-V servers and their Virtual machines.

For now I get all my servers with this query:

var searcher = new DirectorySearcher(new DirectoryEntry("LDAP://" + domainName))
{           
    Filter = "(&(cn=Microsoft hyper-v)(objectCategory=serviceConnectionPoint))"
}

How to list all the virtual machines running on one specific server?

Upvotes: 1

Views: 1134

Answers (1)

Paradise228
Paradise228

Reputation: 717

The solution is to use WMI to connect to the server. Here are some good explanations : http://blogs.technet.com/b/richard_macdonald/archive/2008/08/11/3103559.aspx

Upvotes: 1

Related Questions