Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save non7top/2d665300ad15ab81a691fe04fab4938f to your computer and use it in GitHub Desktop.
Save non7top/2d665300ad15ab81a691fe04fab4938f 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