Welcome to this first part of the ‘unofficial SDK for VMware View”. You might wonder, why “unofficial”? Well, simple, VMware View is one of the few products from VMware that does not have an SDK :-( So if you want to script/program/automate anything against VMware View, you are out of luck. That is, officially you can not.

VMware View uses Microsoft ADAM (Active Directory Application Mode) to store its data. After a day of googling and puzzling, I was finally able to figure out how to do some of these ADAM calls myself using visual basic and powershell. In this part 1, I want to share 2 beginning powershell scripts with you.

Script 1 – Show Desktop Pool Properties

$poolname = "type_here_your_pool_Unique ID name"
$connectionbroker = "type_here_your_IP_of_your_connection_broker"
$userName = "type_your_username"
$userPassword = "type_your_password""

$ldaproot = "LDAP://$connectionbroker/CN=$poolname,OU=Applications,DC=vdi,DC=vmware,DC=int"

$directoryEntry = New-Object System.DirectoryServices.DirectoryEntry($ldapRoot)
$directoryEntry.psbase.Username=$userDn
$directoryEntry.psbase.Password=$userPassword

$directoryEntry.get_Properties()

Script2 – Disable/Enable a desktop pool

$poolname = "type_here_your_pool_Unique ID name"
$connectionbroker = "type_here_your_IP_of_your_connection_broker"
$userName = "type_your_username"
$userPassword = "type_your_password"

$ldaproot = "LDAP://$connectionbroker/CN=$poolname,OU=Applications,DC=vdi,DC=vmware,DC=int"

$directoryEntry = New-Object System.DirectoryServices.DirectoryEntry($ldapRoot)
$directoryEntry.psbase.Username=$userName
$directoryEntry.psbase.Password=$userPassword

# 0 = enabled 1 = disabled
$directoryEntry.InvokeSet("pae-Disabled",0)
$directoryEntry.CommitChanges()

Script 2 can be used to make any changes. If you for instance did not want to change the pool state, but it’s displayname, you can just replace the 2nd last line with:

$directoryEntry.InvokeSet("pae-displayname","type_your_new_display_name")


The next thing I want to find out is how to query which desktops are actively being used and the state of each desktop, but I have not been able to figure this our yet. If anyone would like to help out on this project, please contact me!