Sunday, March 25, 2012

Sample procedure for updating / recomposing VMware View 5.0 linked-clone master images without using VMware View Administrator

I’m not much of an operations administrator as most of my work are project based deployments so I always tell my clients that they’ll always know more about how to streamline tasks and manage their virtual environments.  With that being said, we do have clients which have support contracts with us and the consultant who deployed the solution is also usually the one who ultimately manages the backend.  As shown in my recent posts, I’ve been involved with a VMware View 5.0 deployment for a client over the past few months and have been managing the environment after the rollout and one of the more time consuming tasks I’ve found is when I have to update the master images with patches or install new applications.  To decrease the amount of time and make the task less tedious (it’s pretty boring to install updates and patches), I used PowerCLI to cut all the administrative tasks I had to use the VMware View Administrator console for so I can simply update all of the master images, then execute a few cmdlets to snapshot the VMs and recompose the linked-clone pools.

Prerequisites:

  1. Your master images are all filed into a folder within vCenter.
  2. You have installed vSphere PowerCLI onto a server (i.e. your vCenter).

Steps:

  1. Start by turning on all of your master images.
  2. Install the Windows updates and / or new application.
  3. Shutdown the master images.
  4. **Optional** If you want to delete the old snapshots, issue the following PowerCLI cmdlet: 
    Get-VM -Location "Master Images" | Get-Snapshot | Remove-Snapshot -Confirm:$false
    For more information about this cmdlet, see my previous post: http://terenceluk.blogspot.com/2012/03/remove-all-snapshots-for-virtual.html
  5. Create a snapshot for all of the master images located in your folder containing them with the following cmdlet:  http://terenceluk.blogspot.com/2012/03/creating-new-snapshot-for-virtual.html
    Get-VM -Location "Master Images" | New-Snapshot -Name "Snapshot" -Confirm:$false
    For more information about this cmdlet, see my previous post:
  6. Recompose each of your pool with the following cmdlet:
    Get-DesktopVM -pool_id 900 | Send-LinkedCloneRecompose -schedule ((Get-Date).AddMinutes(2)) -parentVMPath "/New Datacenter/vm/View Templates/Susan-Tmp" -parentSnapshotPath "/March 16/March 18" -forceLogoff $true -stopOnError $true
    For more information about this cmdlet, see my previous post: http://terenceluk.blogspot.com/2012/03/how-to-recompose-vmware-view-50-linked.html
  7. Update your parent VM’s (master image) snapshot with the latest snapshot with the following cmdlet:
    Update-AutomaticLinkedClonePool -pool_id 100 -parentSnapshotPath “/March 19/March 24”
    For more information about this cmdlet, see my previous post: http://terenceluk.blogspot.com/2012/03/updating-a-vmware-view-50-automatic.html

Your linked-clone pools should now begin to get recomposed by VMware View and your pool’s parent VM will now use your latest snapshot to create any additional linked-clones.

***Note that one of the tips I learned off of a client was that since there is no way to only start the copying process of the master image’s snapshot and once the recompose operation begins, your virtual machines are taken offline, you can begin the snapshot copy process by scheduling your recompose operation at a designated time overnight.  The difference here is that because you’ve scheduled the recompose operation to begin, say, at 12:00a.m. and the time you scheduled it was, say, 3:00p.m., you’ll notice that the snapshot copy process starts right away but your virtual desktops won’t get taken offline until 12:00a.m.

No comments: