I am working with PowerShell scripting on Windows Server 2012 R2. I was checking on the test connection of a machine with port. The following PowerShell command is working:
Test-NetConnection localhost -Port 445
This command along with -InformationLevel
was returning either TRUE
or FALSE
depending on the result. This is exactly what I wanted.
I need to run the same check on Windows Server 2008 R2. I understood that Test-NetConnection
command will not work on Server 2008. I couldn't find any other commands to check the connection between machineIP and port and return whether TRUE
or FALSE
. Can anyone please suggest an alternative PowerShell command for this?