Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This script will enable WinRM
param
(
[string]$Hostname = $env:COMPUTERNAME
)
try
{
$ErrorActionPreference = 'Stop';
$CertificateThumbprint = (New-SelfSignedCertificate -DnsName $Hostname -CertStoreLocation Cert:\LocalMachine\My).Thumbprint;
New-WSManInstance -ResourceURI 'winrm/config/listener' -SelectorSet @{Address='*';Transport='https'} -ValueSet @{Hostname=$Hostname;CertificateThumbprint=$CertificateThumbprint}
}
catch
{
throw $_;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.