How to: Automate Horizon Mirage tasks via API and PowerShell

VMware Horizon Mirage is a layered image management solution that separates the PC into logical layers, which are owned and managed by either IT or the end user. Mirage enables enterprise IT administrators to centrally control the base and application layers guarantying a consistent view of the image across all endpoints. Through the Mirage Management Console, the administrator configures and manages clients, base images and app layers, performs operations such as updates and restores, and monitors the system operation through the dashboard and event logs.

In a SDDC environment automation is one the most critical pieces to ensure all parts work together. Despite Mirage provides all management capabilities via a full-featured dashboard, the lack of an supported API hinders the ability to promote datacenter automation.


So, I have 2 good news for Mirage administrators.

Good News N°1 – There is a web API in the Mirage Server. It’s hidden, clunky and undocumented – but it’s there.

Good News N°2 – I have created a VMware Mirage PowerShell Automation Module and I am sharing it with the broader community.


Important – the Mirage API approach is TOTALLY UNSUPPORTED BY VMWARE. I recommend testing in a development environment. If you decide to test or implement you are doing it on your own risk.


I am sharing this module with the borader community to enable administrators to create automation for Horizon Mirage taks via PowerShell. The cmdlets can be executed manually or be part of a larger PowerShell script, or even be triggered by automation and workflow tools like VCAC, vCenter Orchestrator or Puppet.

This version of automation module was created for and tested with Mirage V3.7_SP1 and no forward or backward compatibility is guaranteed. I know for fact that some of the cmdlets will not work with Mirage 4.0 and need to be updated given the Mirage API has changed since.

I am hoping that sharing this module with the community will enable administrators to understand how to implement it and build upon what I have created. If you update this module or add new functions and cmdlets I would appreciate you sharing back with the community.


The module contains the following functions:

  • Add-MirageCollection
  • Assign-MirageBaseImage
  • Centralize-MirageEndpoint
  • ConfirmRestore-MirageEndPoint
  • Connect-Mirage
  • DeCentralize-MirageEndpoint
  • Get-MirageCVDBaseImage
  • Get-MirageEndPoint
  • Get-MirageEndpointSnapshot
  • Remove-MirageCollection
  • Remove-MirageEndpoint
  • Restart-MirageEndpoint
  • Restore-MirageEndPointSnapshot
  • Resume-MirageEndpointNetworkOperations
  • Suspend-MirageEndpointNetworkOperations


The functions (cmdlets) are self-explanatory, but additional information about how to use it can be found in the module header. To load the module, open a PowerShell session and type “Import-Module -Name mirage_module.psm1”.


Download the module here.


Here are some examples of how to execute the cmdlets after the module has been loaded.

[css language=”2=”]
Connect-Mirage -mgmtHost "x.x.x.x" -username "administrator" -password "password" -DLLpath "C:\Program Files\VMware\Wanova\"
Get-MirageCollection -collection "collectioname"
Add-MirageCollection -collection "collectioname" -filter "mirage01"
Remove-MirageCollection -collection "collectioname"
Centralize-MirageEndpoint -Endpoint "endpointname" -BaseLayer "baseline"
DeCentralize-MirageEndpoint -Endpoint "endpointname"
Get-MirageEndPoint -ContainerType:Pending
Remove-MirageEndpoint -Endpoint "endpointname"
Get-MirageSnapshot -Endpoint "endpointname"
ConfirmRestore-MirageEndPoint -Endpoint "endpointname"
Suspend-MirageNetworkOperations -Endpoint "endpointname"
Resume-MirageNetworkOperations -Endpoint "endpointname"
Restart-MirageEndpoint -Endpoint "endpointname"
Assign-MirageBaseImage -Endpoint "endpointname" -BaseLayer "baseimagename" -MajorVersion 1 -MinorVersion 2


In order to support different version of VMware Horizon Mirage you will need to create a new DLL. To create a new DLL to make the module work with different versions of Mirage one should follow the following steps:


  1. Replace Management Server configuration (“baseAddresses”) – replace “localhost” in “ <http://localhost:8443/WanovaAd… with the actual machine address – required for the next step to work
  2. Create stub client code from WSDL: SvcUtil.exe
    http://<Management address>:8443/WanovaAdmin?wsdl – creates LicensedAdminApi.cs
    The resulting LicensedAdminApi.cs file will contain the service contract (the methods, resulting from the WSDL) and the data contracts (the data portion, coming from the XSD) for your service.
  3. Compile the client: csc.exe /t:library LicensedAdminApi.cs – creates LicensedAdminApi.dll


If you cannot find csc.exe in your environment please follow this instructions to detect what .NET Framework versions and service packs are installed.

Please note that even with a new WSDL/DLL the PowerShell module would need to be fully tested for compatibility. The reason being is that the Mirage WEB API is constantly changing and is not supported for remote interaction.


This article was first published by Andre Leibovici (@andreleibovici) at


Skip to comment form

    • Robert Riemer on 06/07/2013 at 3:33 am

    Hi Andre,

    thanks for the great post. I trie to user Horizon Mirage 4.0 and i already imported your module and also greated a new DLL. So the connect to the mirage server works but i have a question concerning the Restore-MirageEndPointSnapshot. Can u tell me more details about the command? I do not get it to run. Also the get-help command did not help me.
    What does the -hours means? Have u ever try it?


  1. Robert,

    I have only tested the cmdlets with Mirage V3.7_SP1. I don’t think we had -hours in V3.7_SP1. Try entering ‘null’. Restore-MirageEndPointSnapshot will return the machine to a previously known state.


    • Daniel Casota on 09/11/2013 at 12:44 am

    Hello Andre,

    Thanks for this post and many others for so many years!
    We try to automate the upload of pending devices and are beginning with your Automation Module, compiled for 4.2.x. By calling Get-Mirageendpoint -ContainerType:Pending we get stuck on errors. Could you post an example where to start using the get-mirageendpoint function?


  2. Daniel, the Mirage API itself has changed between releases and the POSH module I created will not work any longer. You will need to examine the WSDL you have generated from Mirage 4.2 web interface and make code changes to the POSH code.


Leave a Reply