You can use the Horizon Agent CommandsToRunOnConnect, CommandsToRunOnReconnect, and CommandsToRunOnDisconnect group policy settings to run commands and command scripts on Horizon 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:

date

C:\Scripts\myscript.cmd

To run scripts that require console access, prepend the -C or -c option followed by a space. For example:

-c C:\Scripts\Cli_clip.cmd

-C e:\procexp.exe

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.