Skip to content

Instantly share code, notes, and snippets.

@thomasalley
Last active December 12, 2017 17:32
Show Gist options
  • Save thomasalley/d27c61eb660c19ccf571 to your computer and use it in GitHub Desktop.
Save thomasalley/d27c61eb660c19ccf571 to your computer and use it in GitHub Desktop.
Quickly bootstrap a Windows host to allow insecure connections. Also creates an HTTPS listener with a self-signed cert.
winrm quickconfig -q -force
Enable-psremoting –force
Set-executionpolicy bypass –force
winrm set winrm/config/service/Auth '@{Basic="true"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}'
winrm set winrm/config/client '@{TrustedHosts="*"}'
# Configuration Warning:
# http://blogs.msdn.com/b/powershell/archive/2015/10/27/compromising-yourself-with-winrm-s-allowunencrypted-true.aspx
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
$cert = Get-childItem cert:\LocalMachine\Root | Where-Object Subject -like "*$env:COMPUTERNAME*"
$cn = $cert.Subject.Replace('CN=','')
$thumbprint = $cert.thumbprint
New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $thumbprint –Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment