You can setup the Horizon PowerCLI module with VMware PowerCLI and use the Horizon PowerCLI cmdlets to connect or disconnect from Connection Server. After you connect to the Connection Server, you can write PowerShell scripts that invoke the Horizon APIs.


  1. Install VMware PowerCLI.

    Install VMware PowerCLI from the PowerShell Gallery. To install VMware PowerCLI, run the following command in the Windows PowerShell prompt:

    Install-Module -Name Vmware.PowerCLI 

    This command installs all the VMware PowerCLI modules into Windows PowerShell. The VMware.VimAutomation.HorizonView module is the Horizon PowerCLI module.

    You can also download and install VMware PowerCLI from

    For more information on how to install VMware PowerCLI, see the VMware PowerCLI User's Guide available at

  2. Import the Horizon PowerCLI module named VMware.VimAutomation.HorizonView in the Windows PowerShell session.

    Use the following command to import VMware.VimAutomation.HorizonView into the Windows PowerShell session:

    Import-Module -Name VMware.VimAutomation.HorizonView 

    VMware.VimAutomation.HorizonView contains the Connect-HVServer and Disconnect-HVServer cmdlets that you can use to connect to a Connection Server or disconnect from a Connection Server.

  3. Pull sample scripts from the github repository.

    After you use the Connect-HVServer cmdlet to connect to the Horizon API service of the Connection Server, you can run PowerShell scripts that invoke the Horizon APIs. For more information about Horizon APIs, see the View API Reference documentation available at

    Example scripts for the Horizon PowerCLI module are available as the VMware.Hv.Helper module in the Modules section at

What to do next

Use the example scripts directly or modify the scripts to suit your automation needs. Apart from example scripts, you can also develop new scripts that invoke Horizon APIs based on your needs. See, Run Example Horizon PowerCLI Scripts.