Difference between revisions of "Winrm https basic auth with pywinrm"

From UVOO Tech Wiki
Jump to navigation Jump to search
(Created page with "``` # Configure WinRM to use HTTPS and enable basic authentication Enable-PSRemoting -Force -SkipNetworkProfileCheck Set-Item WSMan:\localhost\Service\Auth\Basic -Value $true...")
(No difference)

Revision as of 05:13, 14 February 2024

# Configure WinRM to use HTTPS and enable basic authentication
Enable-PSRemoting -Force -SkipNetworkProfileCheck
Set-Item WSMan:\localhost\Service\Auth\Basic -Value $true
Set-Item WSMan:\localhost\Service\AllowUnencrypted -Value $false

# Create a self-signed certificate (replace with a valid certificate in production)
$cert = New-SelfSignedCertificate -DnsName "localhost" -CertStoreLocation cert:\LocalMachine\My
$thumbprint = $cert.Thumbprint

# Configure WinRM listener to use HTTPS and the created certificate
New-Item -Path WSMan:\localhost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $thumbprint -Force

# Restart WinRM service to apply changes
Restart-Service WinRM