Skip to content

Instantly share code, notes, and snippets.

@fenneh
Created May 3, 2012 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fenneh/2589906 to your computer and use it in GitHub Desktop.
Save fenneh/2589906 to your computer and use it in GitHub Desktop.
Using PortQry to test Firewall Rules
# Grab some user input
$Server = Read-Host "Enter the Server's name or IP"
$Port = Read-Host "Enter the Port Number"
# Be careful of this path~!
$K = C:\PortQryV2\PortQry.exe -n $Server -e $Port -p TCP
$L = $K -Match "LIS?"
If($L -ne $null)
{
$res = $Port + " on " + $Server + " is " + "Open"
Write-Host $res
}
Else
{
$res = $Port + " on " + $Server + " is " + "Closed"
Write-Host $res
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment