Few PowerShell One-Liners To Check WinRM Settings on Remote Machines

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

Continue reading
%d bloggers like this: