Puppet Class: winrm::config::ps_remoting

Defined in:
manifests/config/ps_remoting.pp

Summary

Configures the use of Powershell remoting https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/enable-psremoting?view=powershell-7

Overview

Examples:

Usage:

class { 'winrm::config::ps_remoting':
  skip_network_profile_check => false,
}

Parameters:

  • skip_network_profile_check (Boolean) (defaults to: $winrm::skip_network_profile_check)

    If Enable-PSRemoting should skip the network profile check. Default is false



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'manifests/config/ps_remoting.pp', line 12

class winrm::config::ps_remoting (
  Boolean $skip_network_profile_check = $winrm::skip_network_profile_check,
) {
  if $skip_network_profile_check {
    $ps_remoting_cmd = 'Enable-PSRemoting -SkipNetworkProfileCheck -Force -ErrorAction Stop'
  } else {
    $ps_remoting_cmd = 'Enable-PSRemoting -Force -ErrorAction Stop'
  }

  exec { 'Enable-PSRemoting':
    command  => $ps_remoting_cmd,
    unless   => 'If (!(Get-PSSessionConfiguration -Verbose:$false) -or (!(Get-ChildItem WSMan:\localhost\Listener))) { exit 1 }',
    provider => powershell,
  }
}