In this post we’ll go over writing a View PowerCLI script to schedule a recompose of a desktop pool.
If your like most VMware View administrators you’ll probably use linked clones, and know that now and again these clones will need recomposing to keep up to date with operating system patches or updates for embedded applications. If your organisation is like mine and operates on a 24 hours basis, getting downtime to perform a recompose can end up being headache and is usually scheduled for a unsavory hour.
Unfortunately scheduled tasks was not part of the View v5 release which i imagine left many people in my situation slightly disappointed. To get around this need for functionality, i turned to the View PowerCLI extensions and wrote a script to perform my desired tasks.
Below you will fine my script, along with one of my working examples that allows you to specify a linked clone pool to be recomposed from a specific virtual machine and snapshot at a defined time and date.
Script: Get-Pool -pool_id your-pool-id | Get-DesktopVM | Send-LinkedCloneRecompose -schedule ‘yyyy-MM-dd-23 hh:mm’ -parentVMPath “your-parent-vm-path” -parentSnapshotPath “your-snapshot-path“
Example: Get-Pool -pool_id LC-EXT-H2F | Get-DesktopVM | Send-LinkedCloneRecompose -schedule ‘2012-01-23 11:42’ -parentVMPath “/Hangar 1/vm/VMware View/Linked Clones/viewpocmlc” -parentSnapshotPath “/Base Windows 7 Image/Base Windows 7 Tweaked/Windows 7 with Basic Apps”
Below is an example desktop pool’s options which details the paths for -parentVMPath shown under Parent VM, and -parentSnapshotPath shown under Image.
Thanks for reading and be sure checkout how to schedule the refresh of a desktop pool Here
Big thanks to https://siplifi.com