Need to make sure that PortQry is downloaded from the microsoft site and use below powershell script to check the same
$Servername = Read-Host “Enter the Servername”
$PortNumber = Read-Host “Enter the Port Number”
$K = .\PortQry.exe -n $Servername -e $PortNumber -p TCP
$L = $K -Match “LIS?”
If($L -ne $null)
{
$res = $servername + ” has ” + $PortNumbe + “Opened”
Write-Host $res
}
Else
{
$res = $servername + ” has ” + $PortNumbe + “Closed”
Write-Host $res
}