Question

Ceci est mon actuel code PowerShell:

connect-QADService -service 'view.domain.com' -Credential 'MyDomain\Administrator'

$AllVMs= ( get-QADObject -SearchRoot 'vdi.vmware.int/Servers' -type pae-VM -IncludedProperties ipHostNumber,pae-SIDString )

Comment ça peut être réécrit en C # (.NET 3.5)?

Était-ce utile?

La solution

Code:

DirectoryEntry entry = new DirectoryEntry("LDAP://view.domain.com/OU=Servers,DC=vdi,DC=vmware,DC=int", "domain\\Administrator", "paSSw0rd");

DirectorySearcher ds = new DirectorySearcher(entry);
ds.SearchScope = SearchScope.Subtree;
ds.PropertiesToLoad.AddRange(new String[] { "pae-SIDString", "ipHostNumber" });

fonctionne comme un charme:)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top