You can use the Horizon Agent CommandsToRunOnConnect, CommandsToRunOnReconnect, and CommandsToRunOnDisconnect group policy settings to run commands and command scripts on View desktops when users connect, reconnect, and disconnect.
To run a command or a command script, add the command name or the file path of the script to the group policy setting's list of commands. For example:
To run scripts that require console access, prepend the -C or -c option followed by a space. For example:
Supported file types include .CMD, .BAT, and .EXE. .VBS files will not run unless they are parsed with cscript.exe or wscript.exe. For example:
-C C:\WINDOWS\system32\wscript.exe C:\Scripts\checking.vbs
The total length of the string, including the -C or -c option, should not exceed 260 characters.