$cerPath = "C:\Temp\winrm_target_192.168.0.242.
cer" # path where you placed the
file
Import-Certificate -FilePath $cerPath -CertStoreLocation Cert:\LocalMachine\Root
Get-ChildItem Cert:\LocalMachine\Root | Where-Object {$_.Subject -like
"*$env:COMPUTERNAME*"} # or search by thumbprint/subject
# ensure AllowUnencrypted is false
Set-Item -Path WSMan:\localhost\Client\AllowUnencrypted -Value $false
# ensure Basic auth allowed on client if you want to send Basic (we'll pass
credentials via Get-Credential)
Set-Item -Path WSMan:\localhost\Client\Auth\Basic -Value $true
Test-WsMan -ComputerName [Link] -UseSSL
$cred = Get-Credential # enter: [Link]\Administrator (or target\user) and
password
# Interactive session
Enter-PSSession -ComputerName [Link] -Credential $cred -UseSSL
# Single command (non-interactive)
Invoke-Command -ComputerName [Link] -Credential $cred -UseSSL -ScriptBlock {
hostname; whoami }
# Test WinRM over HTTPS
Test-WsMan -ComputerName [Link] -UseSSL
# Test TCP port
Test-NetConnection -ComputerName [Link] -Port 5986
$cred = Get-Credential
# When prompted enter: [Link]\Administrator (or target\user) and the
password
# Normal secure connect (trusted cert)
Enter-PSSession -ComputerName [Link] -Credential $cred -UseSSL
# Exit interactive session
Exit-PSSession