Desktop Policies and Script Execution via Policy Engine
The Desktop Policy feature is introduced in HyWorks Controller v3.4-SP2, enabling administrators to create and manage desktop policies. These policies enable the configuration of user and computer settings for remote desktop connections.
HyWorks v3.6+ has changes in the desktop policy feature for better functional coverage, better architecture. Below is the direct comparison between the old and new Desktop Policy features:
| Desktop Policy v1.0 - HyWorks v3.4-SP2 | Desktop Policy v2.0 - HyWorks v3.6 |
|---|---|
| Policy evaluation and distribution by HyWorks Controller on the connect call. | Policy evaluation and distribution by Policy Engine directly to the desktop agents. |
| Support for desktop policies .pol created using PolicyPlus App | Support for desktop policies .pol created using PolicyPlus App and Script distribution and execution on session events, e.g., post-connect event or post-logout events. |
| Supported with shared hosted desktops only. | Supported with single-session virtual desktops and shared hosted desktops. |
Prerequisites and Version Compatibility
-
HyWorks Controller: v3.6 or later.
-
Platform Support: Windows only (Feature is not supported with Linux platforms currently).
-
Supported Single-session OS Versions: Windows 10, 11.
-
Supported Multi-session OS Versions: Windows Server 2025, 2022, 2019, 2016.
-
-
Supported DVM Tools/Session Host Versions:
-
DVM Tools v3.6.0.1336 or later.
-
Session Host v3.6.0.157 or later.
-
-
Policy Engine: v20250819T1700 or later.
-
Software Prerequisites:
-
Dot Net 4.5 or above for policy plus application
-
PolicyPlus application: This open-source utility is required to export the necessary group policy. To download it, visit the PolicyPlus page on GitHub and scroll down to find the link to the latest downloadable version.
-
Additional Network Port Requirements
| From | To | Port Number | Purpose |
|---|---|---|---|
| HyWorks Controller Nodes | Policy Engine | 38901 | Accessing Policy Management API endpoint. |
| Desktop Virtual Machines | Policy Engine | 38901 | Accessing Policy Management API endpoint. |
| Policy Engine Node | RabbitMQ Servers | 5671 (SSL) 5672 (Non-SSL) |
For HyWorks Controller HA notifications. |
| Policy Engine Node | HyWorks Controller Servers | 38866 | Communication with HyWorks Controller. |
| Policy Engine Node | SQL Servers | 1433 (Default) | Reading Policy and associated data. |
Single API endpoint utilized by the HyWorks Management Console, DVM agents, and others to interact with the OPAL Policy Engine. By default, this API is externally exposed on port 38901 using SSL, configured through nginx.
Desktop Policy Configuration Workflow
-
Create a Desktop Policy Entity with required configurations, i.e., desktop policy in .pol format and/ or Session Event Scripts.
-
Create a Resource Policy with a desktop policy created in step# 1 and an entitlement filter for users/user groups/OUs/desktop pool(s)/server team(s).
-
When the user logs in to VDI, the HyWorks controller sends a JWT token to the desktop agent.
-
The desktop agent will invoke Policy Engine API using the JWT token received from the HyWorks controller to fetch the Desktop Policy rule applicable for the logged-in user.
-
After receiving the Desktop Policy rule, the DVM agent will optionally download desktop policy or script files from the Policy Engine API and subsequently apply the same to VDI.
Steps to Configure Desktop Policies
For end-user environment configuration or customization using event scripts or desktop policies following steps can be followed:
-
Creating a PolicyPlus.Pol file or create a PowerShell/ batch script** to be executed post-session events.
Installation and Configuration of Policy Engine
-
The Policy Engine installation process is defined in detail in the installation section. Please refer Policy Engine Installation guide for a step-by-step process to install Policy Engine.
-
HyWorks Controller configuration to use Policy Engine: Once Policy Engine is correctly installed and configured, the next step is to configure Policy Engine URI in HyWorks Controller:
-
Log in to the HyWorks Controller Management Console with user credentials having super-administrator privileges.
-
Navigate to Settings > General > Advance Settings > Apply Tag Filter Policy Manager.
-
Locate the flag Is Policy Engine Configured, and set it to True.
-
Search for the flag Policy Manager Endpoint and set the value with the policy engine address in the format:
https://OPALServerIP:38901,e.g., https://192.168.1.1:38901. 38901 is the default port for the Policy Engine manager.
-
-
Save the value and update the Advance Settings.
-
HyWorks Controller configuration is completed, and HyWorks Controller will start pushing policy engine URI to the desktop agents with tokens.
-
PolicyPlus: Generating a .pol File
This configuration is to be done on the PolicyPlus application.
-
Open the PolicyPlus application.
-
Navigate to File > Open Policy Resources. Select a location, assign a name to the file with a ".pol" extension, and click OK.
-
All modified policies will be saved in the ".pol" file created in the previous step.
-
Modify the required group policies.
-
After setting all the required policies for the respective changes, navigate to Files and select Save Policies.
-
The same files will be used when applying for the Desktop Policy feature.
Creating a Desktop Policy Entity
-
Log in to the HyWorks Controller Management Console with user credentials having privileges to create a desktop policy entity.
-
Navigate to Policies > Entities > Desktop Policy.
-
Click on Add to start creating a new desktop policy entity.
-
Primary Details:
- Name: Max 100 characters and Description: Max 300 characters for the entity.
-
Desktop Policies:
- Upload the Computer or User policy in
.polformat created using the PolicyPlus app.
- Upload the Computer or User policy in
-
Session Event Scripts: Upload appropriate scripts with arguments, with timeouts (if any) and Execution flags as Run async or no.
-
Scripts are executed only after the session events, e.g., post-connect event or disconnect event.
-
Script Types: Batch and PowerShell scripts are supported.
-
Supported Event Types: Connect, Disconnect, Reconnect, Logout, Lock, Unlock.
-
Script execution context: User context or system context. E.g., opening any prompt or performing activities for the user as a logged-in user can be executed in the user context.
-
Timeouts: Provide a timeout value for script execution. If script execution does not finish in the given time, then the desktop agent will abort the script execution.
-
More than one script: The Run async setting determines how the scripts will be executed, with more than one script configured for one event.
-
With Run async enabled, scripts will be running in async mode without waiting for other scripts.
-
With Run async disabled, scripts will be executed in the same sequence, they are configured.
-
-
-
The administrator must configure at least one type of entity, either a desktop policy or a session event script, to proceed.
-
Click on Create Rule to save the entity.
-
Added entity will be listed with showing Name, Description, added policies (user/ computer) status and added session event scripts status.
-
The next step is to associate this entity with appropriate resources using a resource policy.
-
Creating a Desktop Policy Assignment Rule
Now that the desktop policy with appropriate configurations is available, the next step is to have correct associations for getting it applied.
Resource Policy Specifications:
| Attribute or Configuration | Explanation | Possible Options | Remarks |
|---|---|---|---|
| Name | Name of the resource policy. | 100 chars | - |
| Description | Logical description of the resource policy. | 300 chars | - |
| Rule Type | Type of entity being associated with objects. | User Experience Management Desktop Policy |
- |
| Active | To enable or disable this policy entity association. Policy entity will not get applied. | - | - |
| Order | Decides the priority order in which the assigned policy entities will be applied when multiple policies are found for the object. | 1 to 5 | 1 being the top priority. If there are multiple policies with the same order, the policy will be executed in alphabetical order. |
| Filters | Filters to determine when the policy will be applied. | Filters can be configured for the following objects: - Users - User Groups - Organization Unit - Desktop Pool - Server - Server Teams. |
It is possible to combine multiple conditions using AND, OR, and custom expressions. For custom expressions, nesting is supported up to 2 levels. E.g., ((1 AND 2) OR (3 OR 4)) is allowed, but (1 AND (2 OR (3 AND 4))) is not. |
| Rule Selection | The entity selection for the configured type. | All the entities of the selected type will be listed here. Selecting the entity will display its details. |
To create a new policy rule:
-
Log in to the HyWorks Controller Management Console using user credentials that have privileges to create a desktop policy entity.
-
Navigate to Policies > Policies > Resource Policy.
-
Click on Add.
-
Provide appropriate configurations for
-
Primary Details: Name, Description, Rule Type, Active or not, Order
-
Filters
-
Rule: The entities of the selected type will be listed.
-
-
Select an appropriate entity, and the wizard will display the details of the selected policy entity on the same screen.
-
Click on Create Policy to finish the resource policy creation. A new resource policy will be created and will be displayed in the list.
-
On the next connection, policies will be applied according to the selection criteria/filters.