Skip to content

Instantly share code, notes, and snippets.

@gregjhogan
Created November 11, 2016 23:33
Show Gist options
  • Save gregjhogan/dbe0bfa277d450c049e0bbdac6142eed to your computer and use it in GitHub Desktop.
Save gregjhogan/dbe0bfa277d450c049e0bbdac6142eed to your computer and use it in GitHub Desktop.
Configure WinRM HTTPS w/ self-signed certificate
# configure
$cert = New-SelfSignedCertificate -CertstoreLocation Cert:\LocalMachine\My -DnsName $env:COMPUTERNAME
Enable-PSRemoting -SkipNetworkProfileCheck -Force
New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $cert.Thumbprint –Force
New-NetFirewallRule -DisplayName "Windows Remote Management (HTTPS-In)" -Name "Windows Remote Management (HTTPS-In)" -Profile Any -LocalPort 5986 -Protocol TCP
# connect
Enter-PSSession -ComputerName {X.X.X.X} -Credential (Get-Credential) -SessionOption (New-PsSessionOption -SkipCACheck -SkipCNCheck) -UseSSL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment