Last active
December 12, 2017 17:32
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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