WinSCP PowerShell Module Wrapper

Use at your own risk.

This module can be installed from the PowerShellGet Gallery, You need WMF 5 to use this feature.

# To install WinSCP, run the following command in the PowerShell prompt in Administrator mode:
Install-Module -Name WinSCP

I will no longer be supporting Chocolatey or PSGet for module repos; mainly because i feel the PowerShellGallery is working very well, and Chocolatey takes months to approve packages. I apologize for any trouble this causes.

WinSCP Cmdlets


Example 1:

# Capture credentials.
$credential = Get-Credential
# Create new WinSCP session using captured credentials.
$session = New-WinSCPSession -Credential $credential -HostName $env:COMPUTERNAME -Protocol Ftp
# Use that session to create a new Directory.
New-WinSCPItem -WinSCPSession $session -Path './remoteDirectory' -ItemType Directory
# Upload a file to the directory.
Send-WinSCPItem -WinSCPSession $session -Path 'C:\localDirectory\localFile.txt' -Destination '/remoteDirectory/'
# Close the session object.
Remove-WinSCPSession -WinSCPSession $session

Example 2:

# Create session, download a file, and close the session in one line.
# If the WinSCP.Session Object is passed through the pipeline it will be auto-closed upon the completion of that command.
# To avoid this behavior, set the WinSCP.Session object value to variable to be reused.
New-WinSCPSession -Credential (Get-Credential) -HostName $env:COMPUTERNAME -Protocol Ftp | Receive-WinSCPItem -Path './file.txt' -Destination 'C:\folder\'

This is still a very beta version, with most of the functionality available with WinSCP, I intend on developing this extensively.
I have included the WinSCPnet.dll in the NeededAssemblies folder.

Check back regularly for updates.

this project is licensed with GNU GENERAL PUBLIC LICENSE.