Sunday, March 25, 2012

Updating the a VMware View 5.0 automatic linked-clone pool’s parent VM snapshot

To follow up on one of my previous posts about recomposing an automatic linked-clone pool via PowerCLI:

How to recompose VMware View 5.0 linked-clone virtual desktop pools with PowerCLI cmdlet

… I’ve been meaning to write another blog post to demonstrate how to update a pool’s parent VM’s snapshot so when additional linked-clones are deployed, the newer snapshot would be used because what I’ve noticed is that as changes are made to master image and linked-clones are recomposed with newer snapshots, you will find that you spend quite a bit of time updating the parent VM.  Rather than going through the sluggish GUI, I find it much more efficient to have prewritten PowerCLI cmdlet’s that I can rapidly modify to perform the update for multiple pools.

So to start off, the following master image I have has the following 2 snapshots:

  • March 19
  • March 24


The March 24 snapshot is the newer snapshot that I want to set as the pool’s parent image snapshot.  If you were to use the GUI to make the change, you would proceed with opening up the pool’s properties, click on the Browse button:


… select the newer snapshot and click OK:


Rather than having to go through the same procedure for how ever many pools you have, you can actually use the Update-AutomaticLinkedClonePool cmdlet to perform the update.  Before I actually put the cmdlet and the appropriate switches to make the modifications, let’s take a look at this cmdlet and the available switches by executing the following:

Get-Help Update-AutomaticLinkedClonePool | More


The output for the help on this cmdlet is as follows:


    Updates an automatically provisioned linked-clone pool.

    Update-AutomaticLinkedClonePool -pool_id [<string>] [-description [<string>
    ]] [-displayName [<string>]] [-disabled [<Boolean>]] [-vc_id [<string>]] [-
    vmFolderPath [<string>]] [-resourcePoolPath [<string>]] [-parentVMPath [<st
    ring>]] [-parentSnapshotPath [<string>]] [-datastoreSpecs [<string>]] [-com
    poser_ad_id [<string>]] [-organizationalUnit [<string>]] [-logoffScript [<s
    tring>]] [-postSyncScript [<string>]] [-usevSphereMode [<Boolean>]] [-refre
    shPolicyType [<string>]] [-refreshPolicyDays [<string>]] [-refreshPolicyUsa
    ge [<string>]] [-customizationSpecName [<string>]] [-minimumCount [<string>
    ]] [-maximumCount [<string>]] [-headroomCount [<string>]] [-deletePolicy [<
    string>]] [-dsnSuffix [<string>]] [-namePrefix [<string>]] [-powerPolicy [<
    string>]] [-isProvisioningEnabled [<Boolean>]] [-suspendProvisioningOnError
     [<Boolean>]] [-isUserResetAllowed [<Boolean>]] [-dataDiskLetter [<string>]
    ] [-dataDiskSize [<string>]] [-tempDiskSize [<string>]] [-autoLogoffTime [<
    string>]] [-allowMultipleSessions [<Boolean>]] [-folderId [<string>]] [-def
    aultProtocol [<string>]] [-allowProtocolOverride [<Boolean>]] [-flashQualit
    y [<string>]] [-flashThrottling [<string>]] [<CommonParameters>]

Quite a bit of switches and I have yet to find an API that lists descriptions for each of the switches.  Luckily, what we want to do is just going to require the following 2:

  • -pool_id [<string>]
  • -parentSnapshotPath [<string>]

With the previous 2 required switches identified, let’s look at how we can get the value.

The pool_id value is simple enough to find as it’s just the value under the ID column under Inventory –> Pools:


So for the purpose of this example, the ID of the pool we’re going to update is 100.

The parentSnapshotPath value represents the snapshot you want to use for the linked-clone pool which can be found via the Snapshot manager:


Or via the cmdlet:

Get-Snapshot <parent VM>

In this example, the parent VM is named Win7-Sales-Tmp which means would would execute the following:

Get-Snapshot Win7-Sales-Tmp

***Note: Make sure you use the cmdlet Connect-VIServer <vCenter IP> to connect to the vCenter prior to executing the command above.


Since we have 2 snapshots for this parent VM, you’ll see the oldest snapshot at top and the newest at the bottom:


The path is simply the newest snapshot, followed by the next snapshot separated with a a “/”:

/March 19/March 24

With this information, we can proceed with updating the parent VM’s snapshot by executing the following:

Update-AutomaticLinkedClonePool -pool_id 100 -parentSnapshotPath “/March 19/March 24”


There you have it, the parent VM’s snapshot has been updated with the latest snapshot image.



gb said...

You can get an example data for all those nasty parameters by executing a

get-pool | export-csv pools.csv

against an existing view environment. I use this to quickly restore my lab view environment after a fresh install.

$pools = Import-CSV pools.csv
foreach ($pool in $pools) {
-pool_id $pool.pool_id
-description $pool.description

and so on.


larstr said...

Note that the exported parameters don't reflect 100% the command parameters. Several parameters differ such as defaultprotocol vs protocol, SuspendProvisioningOnError vs ProvisionSuspendOnError and probably other too.

Mikel said...

Hi, Is this a procedure supported by VMware?