Changing PowerShell Execution Policy
Execution policies are a PowerShell security feature and apply to scripts run by UNIFYConnect. This page describes how to configure the policy when required.
Globally
WARNING
This method is only possible if PowerShell 7 is installed on the host machine. If this is not the case, use an alternate method of configuration, such as the Local option outlined below.
The Set-ExecutionPolicy cmdlet changes the execution policy. A policy set for the LocalMachine scope, or for the UNIFYConnect service account under CurrentUser, is used by UNIFYConnect PowerShell scripts.
Locally for UNIFYConnect
Create %InstallDir%\Services\Libs\powershell.config.json and populate it with the required policy. For example:
{
"Microsoft.PowerShell:ExecutionPolicy": "Unrestricted"
}TIP
Local configuration will take precedence over global configuration, if PowerShell 7 is installed on the host machine.
Via Extensibility
From v8.1 onward, the execution policy can be set in the extensibility configuration files for managed PowerShell runspaces, running in or out of process. Refer to PowerShell in UNIFYConnect for more information.
When an execution policy is configured through extensibility, UNIFYConnect starts the PowerShell session with $Env:PSExecutionPolicyPreference set to that policy. PowerShell removes the variable when the session closes; changing the variable within the session does not change the policy.
TIP
During the session, the execution policy that is set for the session takes precedence over an execution policy that is set in the configuration file for the local computer or current user. However, it doesn't take precedence over the execution policy set by using a Group Policy.