Few PowerShell One-Liners To Check WinRM Settings on Remote Machines
To Check if WinRM has been enabled on a Remote machine:
$RemoteMachine = "Remote Machine Name"
[system.convert]::ToBoolean(((winrm get winrm/config/winrs -r:$remotemachine | ?{$_ -imatch "AllowRemoteShellAccess"}).split("="))[1].trim())
To Check the Default HTTP listener port on a remote machine:
$RemoteMachine = "Remote Machine Name"
[System.Convert]:: ToInt32(((winrm get winrm/config/Service/DefaultPorts -r:$RemoteMachine | ?{$_ -imatch "HTTP = " }).split("="))[1].trim())
To Check the Default HTTPS listener port on a remote machine:
$RemoteMachine = "Remote Machine Name"
[System.Convert]:: ToInt32(((winrm get winrm/config/Service/DefaultPorts -r:$RemoteMachine | ?{$_ -imatch "HTTPS = " }).split("="))[1].trim())
Leave a comment