How to Create a Task Scheduler for Horizon Sync Script

The Task Scheduler for Horizon Sync Scripts must be created on the ControlUp Monitor server.

Before creating the scheduled task, you must:

  • Prepare the Task Scheduler to run Horizon Scripts. For more information, see here.
  • Open the ControlUp Monitor Server.
  • Create a permanent folder for the task schedule.
  • Download the Sync PS script, which can be found attached below, and put it in that folder.
  • Create an exceptions.txt file (not mandatory).

To create a Task Scheduler:

Note: 
The steps here are based on the latest Windows version as of 10 August 2020. As this is third party software, we cannot guarantee the specific field names and steps but are giving you the most updated information as of the date we are publishing this article.

  1. Open the Task Scheduler from the Start menu and select Create Task... from the Actions menu and the Create Task screen appears.
  2. In the General tab, enter a Name for the new task that to sync ControlUp with Horizon and select Run whether user is logged on or not in the Security options.
  3. From the Triggers tab:
    • Add a new trigger, by clicking New..., and the New Trigger window appears.
    • From the Begin the task drop-down box, choose On a schedule and choose when to start the task in Task Scheduler, and set the Recur every box to 1 day.
      (The scheduled task can be run as often as every five minutes. The time you set also will be the time the task runs daily.)
  4. From the Actions tab:
    • Click New..., and select Start a program from the Action section.
    • From the Program/script section, choose “powershell.exe” (located in C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)
    • Add the following arguments: (More about the argument below)
      -file "C:\Horizon_Sync_Script\Sync_ControlUP_With_ Horizon_View_v2.ps1" -hvconnectionserverfqdn "cuview71connect.controlup.demo" -targetfolderpath "controlup demo\il datacenter\virtual desktops\horizon demo" -pooldivider "Desktop Pools" -rdsdivider "RDS Farms" -exceptionfile "C:\Horizon_Sync_Script\exceptions.txt"
  5. In the Conditions tab, you may keep the default selection or modify it as you'd like. 
  6. In the Settings tab, select the following:
    • Allow task to be run on demand
    • Stop the task if it runs longer than: (Recommended: 3 days)
    • If the running task does not end when requested, for it to stop
    • Do not start a new instance (from the drop down menu)
  7. Once all the details have been set, click OK, and the new task is created.

Argument Description

Argument:

-file "C:\Horizon_Sync_Script\Sync_ControlUP_With_ Horizon_View_v2.ps1" -hvconnectionserverfqdn "horizon.controlup.demo" -targetfolderpath "controlup demo\il datacenter\virtual desktops\horizon demo" -pooldivider "Desktop Pools" -rdsdivider "RDS Farms" -exceptionfile "C:\Horizon_Sync_Script\exceptions.txt"

Description:

  1. file - (Mandatory) - "C:\Horizon_Sync_Script\Sync_ControlUP_With_ Horizon_View_v2.ps1"
    The location of the Sync PS Script can be changed to any desired location.
  2. hvconnectionserverfqdn - (Mandatory) - "horizon.controlup.demo"
    FQDN of a Connection Server.
  3. targetfolderpath - (Mandatory) - "controlup demo\il datacenter\virtual desktops\horizon demo"
    The path of the folder where all objects are placed in the ControlUp organizational tree.
  4. pooldivider - (Mandatory) - "Desktop Pools"
    The name of the folder where the Desktop Pools are placed in the ControlUp organizational tree.
  5. rdsdivider - (Mandatory) - "RDS Farms"
    The name of the folder where RDS Farms are placed in the ControlUp organizational tree.
  6. exceptionfile - (Not mandatory) - "C:\Horizon_Sync_Script\exceptions.txt" 
    the location of a text file with the list of DNS names for machines you do not want to be added to the ControlUp organizational tree.
    mceclip0.png
Powered by Zendesk