Puppet Class: winrm::config::execution_policy

Defined in:
manifests/config/execution_policy.pp

Summary

Configures the execution policy allowed on the system https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-7

Overview

Examples:

Usage:

class { 'winrm::config::execution_policy':
  execution_policy => 'RemoteSigned',
}

Parameters:

  • execution_policy (String) (defaults to: $winrm::execution_policy)

    Server execution policy to follow. Available options are: ‘AllSigned’, ‘Bypass’, ‘RemoteSigned’, ‘Restricted’, ‘Undefined’, ‘Unrestricted’ Defualt is RemoteSigned



14
15
16
17
18
19
20
21
22
# File 'manifests/config/execution_policy.pp', line 14

class winrm::config::execution_policy (
  String $execution_policy = $winrm::execution_policy,
) {
  exec { 'Set-Execution-Policy':
    command  => "Set-ExecutionPolicy -ExecutionPolicy ${execution_policy} -Scope LocalMachine -Force",
    unless   => "If ((Get-ExecutionPolicy -Scope LocalMachine) -ne '${execution_policy}') { exit 1 }",
    provider => powershell,
  }
}