EUC Synchronization with Universal Sync Script
    • Dark
      Light
    • PDF

    EUC Synchronization with Universal Sync Script

    • Dark
      Light
    • PDF

    Article Summary

    Introduction

    Synchronizing your EUC environment with ControlUp has become easier than ever before, with our Universal Sync Script. This script lets you synchronize your VMware Horizon, CVAD or Citrix Cloud environment with ControlUp so that you can view your VDI machines or connection servers as managed machines.

    Built-in Folder Synchronization

    From version 9.0, you can use built-in synchronization to synchronize your folders and machines without needing to import and configure the Universal Sync Script.

    For example, if you connect a VMware Horizon environment to ControlUp and you run the sync script, a new folder structure with connection servers, pool machines and RDSH farms is created in the organizational tree.
    image.png

    Regularly running the script will automatically synchronize EUC environment changes to ControlUp. In this article, we walk you through the configuration and functionality of the script. By the end you will have learned how to automate your EUC synchronization with ControlUp.

    How you benefit

    • Faster synchronization of your EUC environment
    • Less overhead as no external APIs are needed. The data is pulled from the ControlUp Monitors via the Powershell Monitor API cmdlets introduced in version 8.6.5
    • New script features and enhancements are published in the script library

    Prerequisites

    • ControlUp version 8.6.5 or higher
    • You must already have EUC environments added to the ControlUp organization tree. This can be either VMware Horizon, CVAD or Citrix Cloud
    • A running ControlUp Monitor machine
    • PowerShell execution policy on the monitor server:
      • Bypass or
      • Unrestricted
    • A service account that has the following permissions:
      • Local Administrator privileges
      • Log on as a batch job user right
      • Password never changes attribute
    • User actions to be allowed in the ControlUp Security Policy:
      * Add Machine
      * Remove Machine
      * Add Folder
      * Remove Folder

    Script arguments

    Configure the script behavior by providing the following parameters:

    ArgumentDescriptionValue
    Folder PathThe new folder path to which your EUC environment will be synchronized.String
    Add BrokersIndicate if CVAD Brokers, Citrix Cloud Connectors or Horizon Connection Servers should be synchronizedYes / No
    Exclusions ListMachine names that you want to exclude. You can define a comma-separated list with wildcards (*).

    For example: mac*, serv* will not synchronize machines that start with either "mac" or "serv".
    String
    Cleanup Folders and MachinesFolders or machines that do not exist anymore will be cleaned upYes / No
    Commit ChangesIf set to No, the EUC synchronization will be simulated and no changes are committed to the Real-Time ConsoleYes / No
    Log PathThe log path to which the sync script write the logFolder path of log file
    Log DurationSpecifies how long the log file should be retainedNumber (in days)
    VerbosDebugIf set to Yes, verbose output is written to the log file. This provides more detailed information on the synchronization process.Yes / No
    ModeDefines if the script should save the configuration file only ("save") or run the sync process ("run")Save / Run

    Manual Downloads

    If you prefer to download the XML and the PowerShell script manually, use the links below

    Although we don't recommend running the PowerShell script manually, you can set up a Windows task running this file.

    Step 1 - Create the Configuration file

    Before you can use the sync script, you need to create configuration files. These files contain the configuration that is loaded each time the sync script runs.

    Note

    If you want to change the configuration, run the script action again with the changes you want to make. To store the configuration, use the value Set for the Mode parameter.

    To create the configuration file in the console:

    1. Download the XML and save it to the console machine.
    2. In the Real-Time Console, click Script Actions. In the My Draft Scripts tab, and Import the downloaded XML. Once imported, the script is displayed in the My Draft Scripts tab.
      image.png
    3. Click Modify and open the Settings tab. Set the Execution Context to Other Machine, select a monitor machine on which you want to run the script, and set the user under Shared Credentials. Click OK.
      image.png
      Important

      You must select a monitor machine, otherwise the script will not work correctly. Ensure the shared credentials belong to a local admin user on the monitor machine, as the user needs to be able to write to the %ProgramData% folder.

    4. Create a final version of the script by clicking Finalize.
    5. In the console, right-click the monitor machine that you configured in Step 3 and run the script. Right-click the monitor machine > Script Actions > Universal EUC Sync.
      image.png
    6. In the script arguments window, configure the script behavior. Make sure you set the Mode parameter to Save. For the first run of the script, we recommend to set the Commit Changes parameter to No to simulate the synchronization at the first run. Refer to the script-arguments section to better understand the meaning of the parameters.
      image.png
    7. Upon successful execution of the script, the following screen appears:
      image.png
    8. On the monitor machine, a Universal_EUC_Sync.cfg file and other configuration files are created under %ProgramData%\ControlUp\SyncScripts.
      image.png
    9. The Universal_EUC_Sync.cfg is the configuration file that holds the basic configuration for the sync script.
      image.png

    Step 2 - Run the Script

    The previous step explained how to create the configuration file. Now it's time to start the synchronization process. Before you can start, you can start a test run.

    Start the test run

    1. Run the script again by right-clicking the monitor machine.
    2. Make sure the Preview parameter in the cfg file is set to True. This allows you to simulate the synchronization process.
    3. Once no errors are shown in the output, you can start the synchronization again. Make sure the Preview parameter in the cfg file is set to False.

    For the automatic synchronization, you can use a built-in trigger called Scheduled Trigger or you can run a Windows Task on the monitor machine. Both options are explained in more detail below.

    Option 1: Run the Script with a Scheduled Trigger (Recommended)

    To set up a Scheduled Trigger:

    1. In the console, click Triggers > Add Trigger > Scheduled
    2. Select the following options and click Next
      1. Record Type: Machine
      2. Schedule: Per Minute
      3. Recur every 60 minutes
      4. End. Expiry date of the trigger.
        image.png
    3. Keep the trigger condition empty and click Next.
    4. As a trigger scope, select the folder under which the monitor machine resides. In our example, the hostname of the monitor machine MONITORSERVER is located under a customized folder CU Monitors. Click Next
    Note

    We recommend adding your ControlUp Monitors to a dedicated folder in the ControlUp organizational tree.

    image.png

    1. Click Add to add the EUC sync script.
      image.png
    2. Select the Universal EUC Sync script, click Next.
      image.png
    3. Select the user that should run the script on the monitor machine, click Finish.
      image.png
    4. Click OK to save the follow-up action.
      image.png
    5. Additionally, you can configure other follow-up actions, such as sending an email alert. In this example, we will focus on the action itself without setting another follow-up action. Click Next.
      image.png
    6. Provide a user-friendly Trigger name and click Finish.
      image.png
    7. In the Trigger Settings, select the new trigger and click Apply and then OK.
      image.png

    Option 2: Set up a Scheduled Task

    Another way to automatically trigger the script is by setting up a Windows task which allows you to run the EUC Sync Script on a schedule.

    To create and configure a Scheduled Task:

    1. On the monitor machine, open the Windows Task Scheduler (Start > Run > taskschd.msc)
    2. Select Action > Create Task. Under the General tab, provide the following information:
      • Name. Name for the task.
      • Change User or Group. Service account that should run the task.
      • Select Run whether user is logged on or not.
      • Select Run with highest privileges
        image.png
    3. Under Triggers, click New to create a trigger scheduler. We recommend the following values:
      • Start Date. Start date of the task.
      • Select Daily.
      • Set Repeat task every to 1 hour
        image.png
    4. Under Action, click New to create an action.
      • Program/script: powershell.exe
      • Add arguments (optional): Task argument to call the script. For example: -File "UniversalEUCSync.ps1".
      • Start in (optional): Folder where the script is located. For example: C:\Scripts. Make sure you don't use double quotation marks here.
        image.png
    5. Click OK and enter the user information for running the task.
      image.png
    6. Once the synchronization is complete, you can see the updated organization tree.
      image.png

    Advanced

    Custom Folder Mapping

    Use %ProgramData%\ControlUp\SyncScripts\folder_map.cfg to customize the folder paths created by the sync scripts, and the folders in which machines are placed.

    Map folder paths
    Add mapping rules to replace part of the folder path with a new path, separating the old and new paths with a comma (essentially a 'find and replace' operation).

    Consider this example:

    • Line 1 removes a folder from the path. org\EUC\desktop pools\IC turns into org\EUC\IC.
    • Line 2 replaces a folder. org\EUC\Delivery Groups turns into org\EUC\DGs.
    • Line 3 replaces a folder and adds a folder. org\EUC\Brokers turns into org\EUC\Machines\Delivery Groups

    Map machines to folders
    Add mapping rules to place machines matching a naming pattern into a specific folder.

    Enter the machine naming pattern, using asterisks (*) as wildcards. Add a comma as a separator, followed by the full path of the folder in which to place the machines matching the pattern. The full folder path starts with the root of the sync folder (for example, to place machines in orgName\EUC Sync\Horizon Machines, you need to specify EUC Sync\Horizon Machines as the folder path).

    You must use an asterisk

    When you are mapping machines to a folder, you must use at least one asterisk for the machine name pattern. The sync script searches for machines only if an asterisk is present in the mapping rule.

    Consider this example:

    • Line 1 places all machines with "houston1" somewhere in their name into a folder named "Houston01"
    • Line 2 places all machines with "houston2" somewhere in their name into a folder named "Houston02"

    Custom Site Mapping

    Use %ProgramData%\ControlUp\SyncScripts\site_map.cfg to assign folders or machines to a specific site. Enter the folder path or machine naming pattern (using an asterisk as a wildcard). Add a comma as a separator, followed by the name of a ControlUp site.

    All machines in the folder you specify, or all machines in the folder you specify, will be added to the specified ControlUp site.

    Consider this example:
    image.png

    • Line 1 places all machines matching the pattern LA*WIN10 (such as LA-CU-WIN10p01) to the Los Angeles site.
    • Line 2 places all machines in the folder EUC\NY (such as org\EUC\NY\CTX-PVS-01) to the New York site.

    Custom DNS Mapping

    Use %ProgramData%\ControlUp\SyncScripts\dns_map.cfg to assign a specific DNS entry for folders or machines. Enter the folder path or machine naming pattern (using an asterisk as a wildcard). Add a comma as a separator, followed by the DNS entry.

    Consider this example:

    • Line 1 changes the DNS entry for all machines matching the pattern (for example, enderverse-DC01) to enderverse.root
    • Line 2 changes the DNS entry for all machines in the folder (for example, org\ctx\cloud\CTX-PVS-01) to cloud.ev.root

    Log File

    You can set the log file path and retention period by providing the parameters mentioned in the previous section. By default, log files reside in the %ProgramData%\ControlUp\SyncScripts\Logs directory and are kept for 30 days. Every time the task scheduler runs the script, a new log file is written to this folder. The log file contains information that can help you identify synchronization problems.
    image.png


    Was this article helpful?