Skip to content

PowerShell script execution policy

PowerShell script execution policy is a security mechanism that determines whether PowerShell scripts can run on a Windows system.^[600-developer-operation-maintenance-zabbix-zabbix-key.md]

Default Restrictions

By default, Windows restricts the execution of scripts to prevent unauthorized code from running. If a user attempts to run a script when the policy is restrictive, the system will return an error stating that "script execution is disabled on this system" and that scripts cannot be loaded.^[600-developer-operation-maintenance-zabbix-zabbix-key.md]

Configuration

To allow scripts to run, the execution policy must be modified.^[600-developer-operation-maintenance-zabbix-zabbix-key.md]

Command

The policy is set using the Set-ExecutionPolicy cmdlet.^[600-developer-operation-maintenance-zabbix-zabbix-key.md]

The common setting for enabling script execution while maintaining security is RemoteSigned.^[600-developer-operation-maintenance-zabbix-zabbix-key.md]

Set-ExecutionPolicy RemoteSigned

Administrative Privileges

Changing the execution policy requires the user to open PowerShell with administrator privileges.^[600-developer-operation-maintenance-zabbix-zabbix-key.md]

Sources

^[600-developer-operation-maintenance-zabbix-zabbix-key.md]