Featured VMware {code} Samples for Horizon

February 26, 2022

Welcome back to the Git Commit(ted) to </Dev> Resources series, where today we feature some of my favorite {code} Samples for VMware Horizon. If you’ve been following along with the series, then you’ll no doubt have a grasp of the fundamentals of coding against the Horizon APIs. These resources will provide you with examples of how to put those fundamentals into practice.

Postman Collection – Horizon REST API

Over the last several releases, the REST API has seen many additions, bringing it closer in parity to the SOAP-based API presented through PowerCLI.

While the official API documentation does give us many insights into its uses, our very own Chris Halstead has taken it one step further by creating a Postman Collection.

If you don’t have Postman already, you can demo it right from your browser using Postman for Web.

A screenshot of a computer</p>
<p>Description automatically generated

Figure 1: The Postman Collection for Horizon, demonstrated in Postman for Web

Chris has worked diligently to expose every available method each time the API sees an update.

Create or Reset VMs

If you’ve ever spent any considerable time administering Horizon, chances are that image management and creation is one your most time-consuming tasks. Thanks to Graeme Gordon's Create or Reset VMs script, however, that doesn’t have to be the case.

The script interacts with Microsoft Deployment Toolkit (MDT) to automate the creation of images used in the provisioning of Horizon desktops. The biggest advantage of automating this process is that you can start with a brand-new, clean image every time. This results in less bloat and a more consistent deployment.

Included in the bundle, you’ll find two key files:

  1. CreateResetVM.ps1 – the main script itself
  2. VMList.csv – the configuration file for the script

Once you’ve downloaded the script, you’ll want to head over to Using Automation to Create Optimized Windows Images for VMware Horizon VMs to learn how to use it.

Get Instant Clone Pool Information

If you’ve ever wanted to delve into the inner workings of the anatomy of an Instant Clone, then look no further than Mark McGill’s Get Instant Clone Pool Information script. Using this script, you’ll be able to map out all the internal VMs (parent, replicate, template, and master) that a particular Instant Clone depends on, as well as how much space it consumes.

One other feature is the ability to spot orphaned VMs, though that should be a rare occurrence.

Detect Instant Clone from within VM

Chris Halstead once again delivers an incredibly useful, but simple script to Detect if a VM is an Instant Clone from within the VM.

It does this by first detecting the presence of the Horizon Agent. It then checks if the VM is an Instant Clone, and if so, if it is a Type A (traditional) or Type B (parent-less) clone.

Use this in any script or customization where you need to identify the clone type before taking action.

PersonaManagement to FSLogix Migration

There are many options to move away from Persona Management, of course, one of which being the usage of FSLogix Profile Disks. To make this migration somewhat simpler, Chris Halstead comes to the rescue with his PersonaManagement-to-FSLogixProfileContainer-Migration script.

This script accomplishes this feat, in short by:

  1. Creating a VHD or VHDX disk, compatible with the FSLogix Profile Container
  2. Mounting the VHD(X)
  3. Copying the target user’s Persona to the FSLogix Profile Container

Once complete, you’ll be one step further along on your VDI Modernization journey.


I hope that you’ve found these resources helpful. Be sure to leave a comment with your favorite VMware {code} Sample for Horizon!


Make sure to check out the other blog posts in our 28-day series:

Filter Tags

Horizon Horizon Workspace ONE Access Workspace ONE Intelligence Workspace ONE UEM Blog Technical Overview Intermediate Windows 10 Optimize