I have an ftp
server on a cloud VPS instance. The IP can be obtained from a domain like myvps.example.com
.
I would need to run a powershell
script across a variety of computers that are sitting behind a firewall
. The purpose of this powershell
script would be to return whether that server can be reached on port 21 or not. A yes/no
or true/false
response would be ideal so that I can easily look through the logs returned by these systems and see which systems failed.
I was looking into the ftp
command in Windows
but it opens a connection and is not what I was looking for in terms of receiving a quick and easy true/false
response.
This is so that I can see which systems don’t have access and would need to modify the firewall.
Any suggestions on how I can go about this?
I was thinking of this command:
Test-NetConnection -ComputerName myvps.example.com -Port 21 |findstr "TcpTestSucceeded"
However, I previously used Test-NetConnection
on some systems for port 443, and it returned True
. However, when I tried to use that system for port 443 things, it didn’t work. This is from something previous and unrelated. Just my experience with Test-NetConnection