Open Hamsterman opened 6 years ago
If you look at the help for the cmdlet you will see options to set operation and connection timeout
NAME
New-SFTPSession
SYNTAX
New-SFTPSession [-ComputerName] <string[]> [-Credential] <pscredential> [-Port <int>] [-ProxyServer <string>] [-ProxyPort <int>] [-ProxyCredential <pscredential>]
[-ProxyType {HTTP | Socks4 | Socks5}] [-ConnectionTimeout <int>] [-OperationTimeout <int>] [-KeepAliveInterval <int>] [-AcceptKey] [-Force] [-ErrorOnUntrusted]
[<CommonParameters>]
New-SFTPSession [-ComputerName] <string[]> [-Credential] <pscredential> [-Port <int>] [-ProxyServer <string>] [-ProxyPort <int>] [-ProxyCredential <pscredential>]
[-ProxyType {HTTP | Socks4 | Socks5}] [-KeyFile <string>] [-ConnectionTimeout <int>] [-OperationTimeout <int>] [-KeepAliveInterval <int>] [-AcceptKey] [-Force]
[-ErrorOnUntrusted] [<CommonParameters>]
New-SFTPSession [-ComputerName] <string[]> [-Credential] <pscredential> [-Port <int>] [-ProxyServer <string>] [-ProxyPort <int>] [-ProxyCredential <pscredential>]
[-ProxyType {HTTP | Socks4 | Socks5}] [-KeyString <string[]>] [-ConnectionTimeout <int>] [-OperationTimeout <int>] [-KeepAliveInterval <int>] [-AcceptKey] [-Force]
[-ErrorOnUntrusted] [<CommonParameters>]
SFTP is not FTP it is a subprotocol of SSH not FTP over SSL just in case. I see the variable has as a name FTP.
I am trying to upload a file (about 150MB) with the following code
$Session = New-SFTPSession -ComputerName $FTPHost -Credential $MyCredential Set-SFTPFile -SessionId $Session.SessionId -LocalFile "Somefilename.zip" -RemotePath "/" (Get-SFTPSession -SessionId $Session.SessionId).Disconnect()
But I am getting this error
Set-SFTPFile : Session operation has timed out At C:\MyPowerShellScript.ps1:73 char:1
Can I extend the session timeout somehow?