-
Notifications
You must be signed in to change notification settings - Fork 30
Remove WinSCPSession
Thomas Malkewitz edited this page Jul 10, 2015
·
13 revisions
.SYNOPSIS
Removes and item from an active WinSCP Session.
.DESCRIPTION
Removes and item, File or Directory from a remote sources. This action will recurse if a the $Path value is a directory.
.INPUTS.
WinSCP.Session.
System.String.
.OUTPUTS.
None.
.PARAMETER WinSCPSession
A valid open WinSCP.Session, returned from New-WinSCPSession.
.PARAMETER Path
Full path to remote directory followed by slash and wildcard to select files or subdirectories to remove.
.EXAMPLE
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 | Remove-WinSCPItem -Path "/rDir/rFile.txt"
.EXAMPLE
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:\> Remove-WinSCPItem -WinSCPSession $session -Path "/rDir/rFile.txt"
.NOTES
If the WinSCPSession is piped into this command, the connection will be closed and the object will be disposed upon completion of the command.
.LINK
http://dotps1.github.io/WinSCP
.LINK
http://winscp.net/eng/docs/library_session_removefiles