Sending files via FTP with Powershell and WinSCP

So you need to send files  via FTP from Powershell in an automated fashion? Good news is its pretty easy with WinSCP and its .Net Assembly. The example on WinSCP’s website is good but its not a working example as far as production is concerned. Lets wrap it around a function to make it a bit more useful.

First you will need to grab the files from WinSCP’s website here: WinSCP .Net Assembly

Next we will need to load the .Net Assembly:

Using the complete example from WinSCP we can tweak a few of the parameters to wrap a function around and make the method repeatable:

You can now call that function as many times as you need to send data via WinSCP to an FTP server with powershell! Stay tuned for another post regarding downloading data from an FTP server with WinSCP.

3 comments… add one
  • donpablo

    This is not FTP tutorial. It’s SFTP.

    • If you want to split hairs sure, FTP is still in the name. SFTP is typically used in place of FTP/S as it is far more efficient, operates via binary rather then text, and is inherently secure due to the underlying SSH connection.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.