PowerShell: Get WINRM Status of Multiple Computers
Applies to
Need to run this Code from Windows 2012 R2/Windows 2016 /Windows 2019 - PowerShell Version 5.1.
Code Sample
Function Get-RDP-Status {
$ComputerName = Get-Content C:\scripts\computers.txt -ReadCount 0
foreach ($Computer in $ComputerName)
{
Test-NetConnection -cn $Computer WINRM | Select-Object ComputerName,RemotePort,PingSucceeded,TcpTestSucceeded |
FT -AutoSize
}
}
Get-RDP-Status
Output
The same way we can query RDP, HTTP, and SMB.
More
See the below link for more about the cmdlet "Test-NetConnection"