Closed OCram85 closed 4 years ago
I don't have a good way to test this right now, but you can try the -ReconnectTime
parameter on the New-WinSCPSession
cmdlet, just set it to 0.
Thanks, I will try it and let you know the results! 😄
So I tried disabling the reconnect with -ReconnectTime 0
and additionally adding a custom transfer option like this:
Send-WinSCPItem @ParamsSendItem -TransferOptions (
New-WinSCPTransferOption -ResumeSupport (
New-WinSCPTransferResumeSupport -State Off
)
)
Unfortunately it doesn't work either 😢
can you try it on the WinSCP.Session
object. Created with New-WinSCPSession
? use the -ReconnectTime
parameter. the object supports this.
https://winscp.net/eng/docs/library_session (see the ReconnectTime parameter)
Sets time limit in seconds to try reconnecting broken sessions. Default is 120 seconds. Use TimeSpan.MaxValue to remove any limit. The property has to be set before calling Open.
New-WinSCPSession -SessionOptions $sessionOptions -ReconnectTime [TimeSpan]::new(0)
these additional configurations could be set by using AddRawConfiguration:
$ParamsNewWinSCPSessionOption = @{
Credential = $Credential
Hostname = $FTP
Protocol = 'Ftp'
FtpMode = 'Passive'
Timeout = [timespan]::FromMinutes(5)
}
$SessionOption = New-WinSCPSessionOption @ParamsNewWinSCPSessionOption
$WinSCPSession = New-WinSCPSession -SessionOption $SessionOption
$WinSCPSession.Close()
$WinSCPSession.AddRawConfiguration('Interface\SessionReopenAuto',0)
$WinSCPSession.AddRawConfiguration('Interface\SessionReopenIdle',0)
$WinSCPSession.AddRawConfiguration('Interface\SessionReopenStall',0)
$WinSCPSession.Open($SessionOption)
@tomohulk: Sorry for the delay!
@schlabbe14 helped me out with this: It works now with customizing the RawConfiguration
....
jip ;-)
Is there a way to disable the auto reconnect feature like within the GUI?