Physical efforts in virtualization and mobility

Automating Creation of Desktop Pools in VMware Horizon

I don’t know about you guys but I really hate the add new pool wizard in VMware Horizon. Generally speaking, I only work with non-persistent pools and during the life of a project will create and tear down a number of pools for dev, test, UAT and then create a bunch or production pools later on. These pools will have pretty much the same settings except for a few things like pool name, naming pattern, target storage etc. I get fed up with having to click around on the same stuff when all I want is effectively a duplicate with a few bits changing. What got me onto this was the desire to fix production pools to specific vSphere network labels detailed here.

First of all you will need some information about your environment, best thing is if you’ve been through the wizard once and have a pool setup like you’d want it to end up, run:

Get-Pool > C:\Temp\Get-Pool1.txt

From the resulting text file you can copy and paste all of the information you’ll need to automate the creation for all future pools. In particular you will want:

vc_id #Virtual Center ID so static setting
vmFolderPath #The parent folder where the desktops will land so static setting
ResourcePoolPath #Path to the vSphere Resource pool, static
ParentVmPath #Path to the Master VM so static setting
ParentSnapshotPath #Path to the particular snapshot of the above VM, more likely dynamic setting
DatastoreSpecs #Path and configuration of storage could be either static or dynamic
Composer_ad_id #Composer ID, static setting
organizationalUnit #Where the Computer accounts in AD will land, dynamic setting
NetworkLabelConfigFile #Path to text file containing the Network labels to use, built in the article mentioned earlier

I’ve noted above which of the settings are static (ones unlikely to change between pools) and which are likely to be dynamic.

Next you can use this example PowerCLI just changing the bits from your Get-Pool. The red text is stuff that is unlikely to change within an environment and the greens are ones that you will probably want to overwrite with the specifics of a new pool. You’ll need to run this on a connection server in an administrative PowerCLI window (you can remotely connect too if you want).

Add-AutomaticLinkedClonePool -Pool_id UAT1 -NamePrefix “UAT1-{n:fixed=2}” -Vc_id 40263e00-123e-43481-9a05-99afg09732c3 -Persistence NonPersistent -VmFolderPath  /Datacenter1/vm/Desktop Pools” -ResourcePoolPath “/Datacenter1/host/Cluster1/Resources” -ParentVmPath “/Datacenter1/vm/Reference Desktops/GOLD01” -ParentSnapshotPath “Snapshot1/Snapshot2/Snapshot3“-DatastoreSpecs “[Aggressive,OS,data]/Datacenter1/Custer1/Storage1” -Composer_ad_id 474cdee0-60dd-447f-bdfr-692rg3f83dbe -UseUserDataDisk $false -organizationalUnit “OU=UAT,OU=Virtual,OU=Clients” -NetworkLabelConfigFile “C:/Temp/label1.txt” -UseTempDisk $false -MinimumCount 10 -MaximumCount 10 – HeadroomCount 1 -PowerPolicy RemainOn -deletePolicy RefreshOnUse -SuspendProvisioningOnError $false -defaultProtocol PCOIP -allowProtocolOverride $false

So this powerCLI string will create a NonPersistent pool called UAT1 with 10 machines using a naming pattern starting at UAT1-01. It will not use a disposable disk, will refresh desktops at logoff, use PCOIP as the protocol and not permit the users to change to RDP. Just changing a few parts of this string means you can quickly create new pools in seconds by just pasting over the pertinent parts, and no more using that annoying wizard that seems to take days to get through…..


One response to “Automating Creation of Desktop Pools in VMware Horizon

  1. Pingback: VMware Horizon 7 – Virtual Desktop Pools – Carl Stalhood

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: