Uploading files to a FTP with Powershell

Uploading files to a FTP with Powershell

Let’s imagine a scenario where a report generated through a Powershell script, needs to be made available to a crowd of users or IT staff.

One method would involve converting the output to HTML, upload the resulting file to a web server. The report would be accessible using any web browser directed to a specific URL.

To upload a file to a remote server, the FTP protocol can be used. Older version of Powershell doesn’t have FTP specific modules, but the author of this article shared a way. I adapted it to make it more secretive with passwords.

Taking advantage of the previous post, about formatted outputting Powershell reports in HTML, we shall output to the FTP server.

The example below will generate a report and upload it.

The result would be a new file in your remote folder.

Powershell-FTP
Powershell-FTP

And after typing the URL, it should display the result.