< Back

Get-SFTPFile

Sat Jan 18, 2020 7:56 pm

NAME Get-SFTPFile



SYNOPSIS

Download a filefrom a SSH Server using SFTP.





SYNTAX

Get-SFTPFile [-SessionId] <Int32[]> [-LocalPath] <String> [-RemoteFile] <String> [[-Overwrite]] [-NoProgress]

[<CommonParameters>]



Get-SFTPFile [-SFTPSession] <SftpSession[]> [-LocalPath] <String> [-RemoteFile] <String> [[-Overwrite]]

[-NoProgress] [<CommonParameters>]





DESCRIPTION

Download a folder from a SSH server using SFTP against a current session.





PARAMETERS

-SessionId <Int32[]>

Session Id number of an exiting SFTP Session.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-RemoteFile <String>

Full path on of file to download on the remote host.



Required? true

Position? 2

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-LocalPath <String>

Folder on the local machine where to download the file to.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-NoProgress [<SwitchParameter>]

@{Text=}



Required? false

Position? named

Default value False

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Overwrite [<SwitchParameter>]

If file is already present locally overwrite it.



Required? false

Position? 3

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-SFTPSession <SftpSession[]>

SFTP Session Object of a currently connected session.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.Int32[]





System.String





SSH.SftpSession[]







OUTPUTS



NOTES









Example 1



PS C:\\> Get-SFTPFile -SessionId 0 -RemoteFile "./.bash_history" -LocalPath "./bash_history_prod1"



Download from the current session path the bash_history file and save it locally.



RELATED LINKS

Online Version: https://github.com/darkoperator/Posh-SS ... aster/docs