Skip to content

Instantly share code, notes, and snippets.

@peerapach
Last active May 23, 2018 11:47
Show Gist options
  • Save peerapach/2ae23fe6945668a584754f4f9c1a954b to your computer and use it in GitHub Desktop.
Save peerapach/2ae23fe6945668a584754f4f9c1a954b to your computer and use it in GitHub Desktop.
Enable WinRM
# turn off PowerShell execution policy restrictions
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope LocalMachine
# configure WinRM
winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="2048"}'
winrm set winrm/config/winrs '@{MaxConcurrentUsers="10"}'
#winrm set winrm/config/winrs '@{MaxProcessesPerShell="0"}'
#winrm set winrm/config/winrs '@{MaxShellsPerUser="0"}'
winrm set winrm/config '@{MaxTimeoutms="7200000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
winrm set winrm/config/client '@{TrustedHosts="*"}'
# open port 5985 in the internal Windows firewall to allow WinRM communication
netsh firewall set service type=remoteadmin mode=enable
netsh advfirewall firewall set rule group="remote administration" new enable=yes
netsh advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow
net stop winrm
sc config winrm start=auto
net start winrm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment