-
Notifications
You must be signed in to change notification settings - Fork 30
Send WinSCPItem
Send file(s) to an active WinSCP Session.
Send-WinSCPItem [-WinSCPSession] <Session> [-Path] <String[]> [[-Destination] <String>] [-Remove] [[-TransferOptions] <TransferOptions>] [<CommonParameters>]
After creating a valid WinSCP Session, this function can be used to send file(s).
A valid open WinSCP.Session, returned from New-WinSCPSession.
Required? | true |
Position? | 0 |
Default value | |
Accept pipeline input? | true (ByValue) |
Accept wildcard characters? | false |
Full path to local file or directory to upload. Filename in the path can be replaced with Windows wildcard to select multiple files. When file name is omitted (path ends with backslash), all files and subdirectories in the local directory are uploaded.
Required? | true |
Position? | 1 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
Full path to upload the file to. When uploading multiple files, the filename in the path should be replaced with ConvertTo-WinSCPEscapedString or omitted (path ends with slash).
Required? | false |
Position? | 2 |
Default value | / |
Accept pipeline input? | false |
Accept wildcard characters? | false |
When present, deletes source file(s) after transfer.
Required? | false |
Position? | named |
Default value | |
Accept pipeline input? | false |
Accept wildcard characters? | false |
Transfer options. Defaults to null, what is equivalent to New-TransferOptions.
Required? | false |
Position? | 3 |
Default value | (New-Object -TypeName WinSCP.TransferOptions) |
Accept pipeline input? | false |
Accept wildcard characters? | false |
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
It represents a session and provides methods for manipulating remote files over SFTP, SCP or FTP session.
Represents text as a series of Unicode characters.
WinSCP.TransferOperationResult
Represents results of transfer operation.
If the WinSCPSession is piped into this command, the connection will be closed and the object will be disposed upon completion of the command.
PS C:\> New-WinSCPSession -Credential (New-Object -TypeName System.Managemnet.Automation.PSCredential -ArgumentList $env:USERNAME, (New-Object -TypeName System.Security.SecureString)) -HostName $env:COMPUTERNAME -Protocol Ftp | Send-WinSCPItem -Path 'C:\lDir\lFile.txt' -Destination '/rDir/rFile.txt'Transfers Failures IsSuccess
{C:\lDir\lFile.txt} {} True
PS C:\> $credential = Get-Credential PS C:\> $session = New-WinSCPSession -Credential $credential -Hostname 'myftphost.org' -SshHostKeyFingerprint 'ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx' PS C:\> Send-WinSCPItem -WinSCPSession $session -Path 'C:\lDir\lFile.txt' -Destination '/rDir/rFile.txt' -RemoveTransfers Failures IsSuccess
{C:\lDir\lFile.txt} {} True