Script Library

Boost your management, troubleshoot, and remediation capabilities with scripts created by experts in the IT community.

<< Back to Script Library

Tag: horizon

(35 Scripts)
This script uses the CUActions available in v8.8 onwards to power on VMs on any supported hypervisor. It can be used as a right-click action or as an automated action by a trigger.
Version: 3.0.10  |   Created: 2023-05-20  |   Modified: 2023-06-22  |   Creator: Bill Powell  |   Downloads: 29
This script uses the CUActions available in v8.8 onwards to force power off VMs on any supported hypervisor. It can be used as a right-click action or as an automated action by a trigger.
Version: 4.0.31  |   Created: 2023-05-20  |   Modified: 2023-06-22  |   Creator: Bill Powell  |   Downloads: 15
Enables provisioning on a Horizon RDS Farm

Can be used as an automated or manual action to enable provisioning for a Horizon RDS Farm

This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console) which is part of the relevant Desktop Pool. The script uses the target machine to determine the connection server address and the Desktop Pool name, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI to be installed on the machine running the script.

PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 2.1.8  |   Created: 2023-04-06  |   Modified: 2023-05-23  |   Creator: Wouter Kursten  |   Downloads: 10
Disables provisioning on a Horizon RDS Farm

Can be used as an automated or manual action to disable provisioning for a Horizon RDS Farm

This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console) which is part of the relevant Desktop Pool. The script uses the target machine to determine the connection server address and the Desktop Pool name, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI to be installed on the machine running the script.

PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 2.1.9  |   Created: 2023-04-06  |   Modified: 2023-05-23  |   Creator: Wouter Kursten  |   Downloads: 8
Enables a Horizon RDS Server

Can be used as an automated or manual action to enableHorizon RDS Server after troubleshooting or maintenance.

This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console) which is part of the relevant Desktop Pool. The script uses the target machine to determine the connection server address and the Desktop Pool name, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI to be installed on the machine running the script.

PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 2.0.3  |   Created: 2023-04-06  |   Modified: 2023-05-23  |   Creator: Wouter Kursten  |   Downloads: 12
Disables a Horizon RDS Server

Can be used as an automated or manual action to disable Horizon RDS Server for troubleshooting or maintenance.

This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console) which is part of the relevant Desktop Pool. The script uses the target machine to determine the connection server address and the Desktop Pool name, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI to be installed on the machine running the script.

PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 2.0.12  |   Created: 2023-04-06  |   Modified: 2023-05-23  |   Creator: Wouter Kursten  |   Downloads: 13
This script uses the Powershell module of the Horizon Session Recording fling to stop the recording of a BLAST session of a user.
Requirements: Horizon Session Recording 2.2.0 or higher
Link: https://flings.vmware.com/horizon-session-recording
Version: 1.3.10  |   Created: 2020-11-05  |   Modified: 2020-11-17  |   Creator: Wouter Kursten  |   Downloads: 28
This script uses the Powershell module of the Horizon Session Recording fling to start the recording of a BLAST session of a user.
Requirements: Horizon Session Recording 2.2.0 or higher
Link: https://flings.vmware.com/horizon-session-recording
Version: 1.3.12  |   Created: 2020-11-05  |   Modified: 2020-11-17  |   Creator: Wouter Kursten  |   Downloads: 52
Shadows Citrix, VMware, RDSH and WVD sessions
Version: 1.3.13  |   Created: 2020-10-15  |   Modified: 2020-10-20  |   Creator: Trentent Tye  |   Downloads: 324
The script displays VDI machines and RDS hosts that are not running on the same Golden Image and Snapshot that are configured in the Desktop Pool settings. It offers the option to delete VDI machines with or without forcing the user to logoff. Uses the Horizon PowerCLI api's to pull all snapshot information for Horizon Linked Clones and Instant Clones Desktops pools and RDS farms.
The script also uses the Horizon api's to poll the Cloud Pod status of the system and connects to other pods if Cloud Pod has been enabled.

This Script Requires a Horizon Credential file for the user running the scipt. This can be created using the Create credentials for Horizon scripts Script Action.
Requires Horizon 7.5 or later
This script requires VMware PowerCLI to be installed on the machine running the script. PowerCLI can be installed using the Install and configure VMware PowerCLI Script Action
Version: 3.8.81  |   Created: 2020-09-22  |   Modified: 2023-11-24  |   Creator: Wouter Kursten  |   Downloads: 129
Uses the Horizon REST api's to pull all Error, Warning and Audit_Fail events from the Horizon Event database for all pods. If there is no cloud pod setup it will only process the local pod. After pulling the events it will translate the id's for the various objects to names to show the proper names where needed.

Output is displayed in the console but also saved to a default location of c:windowstempCU_Horizon_error_log.csv

This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console). The script uses the target machine to determine the connection server address, and is executed on the machine running ControlUp Console.
This script requires Horizon Credentials to be set for the account running the scipt on the target machine, these need to be created using the 'Create credentials for Horizon scripts' Script Action
Version: 4.3.12  |   Created: 2020-08-27  |   Modified: 2023-10-25  |   Creator: Wouter Kursten  |   Downloads: 99
Sends messages to the selected Horizon user/s. This script can be used to send messages to a single user session using the Horizon SOAP API's. It can also be used as an automated action with a fixed message and severity level. For the severity level these are allowed: INFO,WARNING, ERROR

This script requires VMWare PowerCLI to be installed on the machine running the script.
PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers' Or by using the 'Install VMware PowerCLI' script.
If you get TLS/SSL errors use this command Set-PowerCLIConfiguration -InvalidCertificateAction ignore
or Set-PowerCLIConfiguration -InvalidCertificateAction warn
To get rid of the CEIP warning use Set-PowerCLIConfiguration -ParticipateInCeip $true
or Set-PowerCLIConfiguration -ParticipateInCeip $false
Credentials can be set using the 'Create credentials for Horizon View scripts' script.
Version: 2.4.6  |   Created: 2020-07-07  |   Modified: 2023-11-24  |   Creator: Wouter Kursten  |   Downloads: 210
Uses the Horizon REST api's to pull all admin related events from the Horizon Event database for all pods. If there is no cloud pod setup it will only process the local pod. After pulling the events it will translate the id's for the various objects to names to show the proper names where needed.

Output is displayed in the console but also saved to a default location of c:windowstempCU_Horizon_audit_log.csv
Version: 4.8.21  |   Created: 2020-04-28  |   Modified: 2023-10-25  |   Creator: Wouter Kursten  |   Downloads: 103
This script acts when provisioning gets disabled for linked clones desktop pools because the overcommit ratio is set too low. It will calculate the correct ratio and set it to that.
After changing the ratio it will enable provisioning and when set to true it can also force a rebalance of the datastores.
When using iwth a trigger the Connection Server FQDN and Horizon Pool name need to be configured manually.

This script requires VMWare PowerCLI to be installed on the machine running the script.
PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers' Or by using the 'Install VMware PowerCLI' script.
Credentials can be set using the 'Prepare machine for Horizon View scripts' script.
Version: 2.1.4  |   Created: 2020-04-02  |   Modified: 2023-11-24  |   Creator: Wouter Kursten  |   Downloads: 43
This script assigns a user to a Horizon desktop machine. This will only work with dedicated desktop pools.It will receive the connection server fqdn, Desktop pool and machine, login and domain names from the CU Console.

This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console). The script uses the target machine to determine the connection server address, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI to be installed on the machine running the script.
PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 1.3.5  |   Created: 2020-02-20  |   Modified: 2020-02-25  |   Creator: Wouter Kursten  |   Downloads: 31
This script unassigns a user from a machine. This will only work with dedicated desktop pools. It will receive the connection server fqdn, Desktop pool and machine names from the CU Console.

This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console). The script uses the target machine to determine the connection server address, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI to be installed on the machine running the script.
PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 1.4.4  |   Created: 2020-02-20  |   Modified: 2020-02-25  |   Creator: Wouter Kursten  |   Downloads: 24
This script deletes a machine from an Horizon desktop pool. If it is a manual pool the machine will only be removed from the pool but not deleted. If it is an automated pool the user can be forcefully logged off (otherwise the script will fail, Horizon 7.7 or newer required) and the machine will be deleted.


This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console). The script uses the target machine to determine the connection server address, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI to be installed on the machine running the script.
PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 1.3.4  |   Created: 2020-02-20  |   Modified: 2020-02-25  |   Creator: Wouter Kursten  |   Downloads: 42
This script will issue the Refresh command for a Horizon Linked Clone.
Version: 2.10.21  |   Created: 2020-02-04  |   Modified: 2022-04-25  |   Creator: Ton de Vreede  |   Downloads: 62
Disables a Horizon Desktop pool

Can be used as an automated or manual action to disable a Horizon Desktop pool for planned maintenance.

This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console) which is part of the relevant Desktop Pool. The script uses the target machine to determine the connection server address and the Desktop Pool name, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI to be installed on the machine running the script.

PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 4.6.27  |   Created: 2020-02-02  |   Modified: 2023-05-24  |   Creator: Ton de Vreede  |   Downloads: 90
This script finds a user session based on username and machine. This user is then logged off, even if the session is locked.
Version: 2.32.50  |   Created: 2020-01-26  |   Modified: 2023-11-24  |   Creator: Ton de Vreede  |   Downloads: 223
This script Recovers a Horizon View Instant Clone using the VMware Horizon api's. You can use this to 'rebuild' an Instant Clone if there is an issue with the machine.
This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console). The script uses the target machine to determine the connection server address, and is executed on the machine running ControlUp Console.
Version: 3.6.8  |   Created: 2020-01-11  |   Modified: 2023-11-24  |   Creator: Ton de Vreede  |   Downloads: 170
This script retreives the administrative users and groups in a Horizon View environment.
You can this script to make sure administrators have the right permissions in Horizon View?
This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console). The script uses the target machine to determine the connection server address, and is executed on the machine running ControlUp Console.
Version: 3.5.9  |   Created: 2020-01-11  |   Modified: 2020-02-04  |   Creator: Ton de Vreede  |   Downloads: 53
This script connects to all pod's in a Cloud Pod Architecture(CPA) or only the local one if CPA hasn't been initialized and pulls all health information for configured UAG's.
This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console). The script uses the target machine to determine the connection server address, and is executed on the machine running ControlUp Console.

Note: Requires PowerCLI 11.4 or higher and Horizon 7.10 or higher
Version: 4.6.9  |   Created: 2020-01-09  |   Modified: 2020-09-23  |   Creator: Wouter Kursten  |   Downloads: 208
Changes the amount VDI desktops in a desktop pool. Use UP_FRONT or ON_DEMAND for the Provisioningtype depending if you want to provision all desktops up front. If UP_FRONT is used minNumberOfMachines and numberOfSpareMachines will be ignored.

This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console). The script uses the target machine to determine the connection server address, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI to be installed on the machine running the script.
PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 4.7.13  |   Created: 2020-01-09  |   Modified: 2023-11-24  |   Creator: Wouter Kursten  |   Downloads: 126
Changes the amount of RDS hosts in a Horizon Farm.

This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console). The script uses the target machine to determine the connection server address, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI to be installed on the machine running the script.
PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 1.5.6  |   Created: 2020-01-09  |   Modified: 2020-02-11  |   Creator: Wouter Kursten  |   Downloads: 17
Connecting to a Horizon Connection server is required for running Horizon scripts. The server does not allow passthrough (Active Directory) authentication. In order to allow scripts to run without asking for a password each time (such as in Automated Actions) a PSCredential object needs to be stored on each target device (i.e. each machine that will be used for running Horizon scripts). This script can create this PSCredential object on the targets.
PSCREDENTIIAL OBJECTS CAN ONLY BE USED BY THE USER THAT CREATED THE OBJECT AND ON THE MACHINE THE OBJECT WAS CREATED.
- The User that creates the file is required to have a local profile when creating the file. This is a limitation from Powershell

Modification history: 20/08/2019 - Anthonie de Vreede - First version
03/06/2020 - Wouter Kursten - Second version

Changelog ;
Second Version
- Added check for local profile
- changed error message when failing to create the xml file
Version: 5.6.14  |   Created: 2019-12-02  |   Modified: 2020-12-08  |   Creator: Ton de Vreede  |   Downloads: 380
Enables a Horizon Desktop pool

Can be used as an automated or manual action to enable a Horizon Desktop pool for planned maintenance.

This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console) which is part of the relevant Desktop Pool. The script uses the target machine to determine the connection server address and the Desktop Pool name, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI to be installed on the machine running the script.

PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 5.11.55  |   Created: 2019-08-22  |   Modified: 2023-05-24  |   Creator: Ton de Vreede  |   Downloads: 59
Enables VMware Horizon Virtual Desktop pool provisioning

Can be used as a manual or automated action to disable Horizon View Virtual Desktop pool provisioning if a resource shortage is detected. This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console) which is part of the relevant Desktop Pool. The script uses the target machine to determine the connection server address and the Desktop Pool name, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI module to be installed on the machine running the script.
PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 3.12.23  |   Created: 2019-08-22  |   Modified: 2023-05-24  |   Creator: Ton de Vreede  |   Downloads: 94
Disables VMware Horizon Virtual Desktop pool provisioning

Can be used as a manual or automated action to disable Horizon View Virtual Desktop pool provisioning if a resource shortage is detected. This action should be executed against a Horizon endpoint machine (one which has the HZ Primary Connection Server column populated in ControlUp Console) which is part of the relevant Desktop Pool. The script uses the target machine to determine the connection server address and the Desktop Pool name, and is executed on the machine running ControlUp Console.

This script requires VMWare PowerCLI module to be installed on the machine running the script.
PowerCLI can be installed through PowerShell (PowerShell version 5 or higher required) by running the command 'Install-Module VMWare.PowerCLI -Force -AllowCLobber -Scope AllUsers'
Version: 3.13.29  |   Created: 2019-08-22  |   Modified: 2023-05-24  |   Creator: Ton de Vreede  |   Downloads: 53
Uses the VMware Horizon API via a Connection Server to query the events database for a given number of days back which contains events summarising the daily use and draws a chart with the data.

Requires the VMware PowerCLI PowerShell modules (specifically VMware.VimAutomation.HorizonView) which can be obtained from https://developer.vmware.com/tool/vmware-powercli
Version: 2.1.47  |   Created: 2019-08-15  |   Modified: 2023-07-30  |   Creator: Guy Leech  |   Downloads: 320
Installs PowerCLI moduleand the required packageprovider NuGet for working with VMware and Powershell for All Users. Also changes the CEIP settings to not send data and Invalid Certificate handling to warn by default.
- Used module Install-Module requires Powershell 5.0 minimum!
- The script will overwrite any existing PowerCLI modules
- MSI based modules must be uninstalled first
Version: 2.1.16  |   Created: 2018-11-26  |   Modified: 2020-06-02  |   Creator: Ton de Vreede  |   Downloads: 237
Get a detailed overview of the most recent logon process for a specific user. This script queries the event log for every major event that relates to the logon process. Use this action to track down which phase is responsible for delays during the logon process. Uses WMI to retrieve pre-Windows logon phase data from Citrix so does not use OData and therefore does not need credentials
Version: 19.32.176  |   Created: 2018-07-02  |   Modified: 2023-11-03  |   Creator: Guy Leech  |   Downloads: 67979
This script provides statistics for a given VMware Blast session
Version: 5.6.44  |   Created: 2018-02-11  |   Modified: 2020-10-28  |   Creator: Ton de Vreede  |   Downloads: 413
Disable Horizon View Maintenance Mode for the selected computer(s).
Version: 3.3.12  |   Created: 2014-11-26  |   Modified: 2022-06-13  |   Creator: Zeev Eisenberg  |   Downloads: 118
Enable Horizon View Maintenance Mode for the selected computer(s).
Version: 3.3.12  |   Created: 2014-11-26  |   Modified: 2022-06-13  |   Creator: Zeev Eisenberg  |   Downloads: 145