Using PowerShell to test an FTP connection

Question:

I have a PowerShell script that performs checks on some servers, for example Test-Connection for PING.

I wish to check one of the servers that has an FTP server by performing an “FTP Open” command. I don’t need to log in or upload/download any files, just need to know if the FTP server responds or not.

Most of my research on the internet points to setting up credentials and importing proprietary modules to connect, perhaps uploading or downloading files, but I just need a simple method to open the connection and tell me either true or false if there is a responding server.

The server I am running this script from should have minimal software installed, but if it needs anything, preferably Microsoft and from their website.

Answer:

Test-NetConnection is native Powershell and can be used to test simple connectivity on FTP Port 21:

Source:

Using PowerShell to test an FTP connection by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply