This module can be installed from the PowerShellGet Gallery, You need WMF 5 to use this feature.
# Inspect
Save-Module -Name WinSCP -Path <Path>
# Install
Install-Module -Name WinSCP
- ConvertTo-WinSCPEscapedString
- Get-WinSCPChildItem
- Get-WinSCPItem
- Get-WinSCPFileChecksum
- Invoke-WinSCPCommand
- Move-WinSCPItem
- New-WinSCPItem
- New-WinSCPItemPermission
- New-WinSCPSession
- New-WinSCPTransferOption
- Receive-WinSCPItem
- Remove-WinSCPItem
- Remove-WinSCPSession
- Rename-WinSCPItem
- Send-WinSCPItem
- Start-WinSCPConsole
- Sync-WinSCPPath
- Test-WinSCPPath
Example 1:
# Capture credentials.
$credential = Get-Credential
# Create new WinSCP session using captured credentials.
# New-WinSCPSession sets the PSDefaultParameterValue of the WinSCPSession parameter for all other cmdlets to this WinSCP.Session object.
# You can set it to a variable if you would like, but it is only necassary if you will have more then one session open at a time.
New-WinSCPSession -Credential $credential -HostName $env:COMPUTERNAME -Protocol Ftp
# Use that session to create a new Directory.
New-WinSCPItem -Path './remoteDirectory' -ItemType Directory
# Upload a file to the directory.
Send-WinSCPItem -Path 'C:\localDirectory\localFile.txt' -Destination '/remoteDirectory/'
# Close the session object.
Remove-WinSCPSession
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.
New-WinSCPSession -Credential (Get-Credential) -HostName $env:COMPUTERNAME -Protocol Ftp | Receive-WinSCPItem -Path './file.txt' -Destination 'C:\folder\'
This is still a beta version, with most of the functionality available with WinSCP, I intend on developing this extensively.
Check back regularly for updates.
This project is licensed with GNU GENERAL PUBLIC LICENSE.