Add timeout to Existing script
Hi
Let me start by apologizing for what might be a easy and silly question.
I inherited support of a PowerShell script that opens a WinSCP sessions to an FTP to download and replace some files daily.
Recently came to the conclusion since both sender and receiver servers are slow combined with some firewalls rules the session time out.
So I need to increase session timeout.
Tried to add timeout command with help from a colleague, that did not work.
After checking similar post I have realized this (
But I'm still terrible unsure where in the script this parameter goes to be applied since our formating seems to be different that most.
I have added both old and last attempt as file and copypasted it below.
New (didn't work)
Old
Let me start by apologizing for what might be a easy and silly question.
I inherited support of a PowerShell script that opens a WinSCP sessions to an FTP to download and replace some files daily.
Recently came to the conclusion since both sender and receiver servers are slow combined with some firewalls rules the session time out.
So I need to increase session timeout.
Tried to add timeout command with help from a colleague, that did not work.
After checking similar post I have realized this (
$session.Timeout = New-TimeSpan -Seconds 120
) seems to be the best solution.
But I'm still terrible unsure where in the script this parameter goes to be applied since our formating seems to be different that most.
I have added both old and last attempt as file and copypasted it below.
New (didn't work)
REM connect to ftp via winscp and runs syncronization REM winscp syntax open ftp://<username>@<host> -explicittls winscp.com /log="OrganizationEXEDownload.log" /timeout=60 /command ^ "open ftp://username:Password.organization.org/ -explicittls "^ "synchronize local . /Organization740 " ^ "exit"
REM connect to ftp via winscp and runs syncronization REM winscp syntax open ftp://<username>@<host> -explicittls winscp.com /log="OrganizationEXEDownload.log" /command ^ "open ftp://username:Password.organization.org/ -explicittls "^ "synchronize local . /Organization740 " ^ "exit"
Last edited by Lekick on 2024-12-04 08:42; edited 1 time in total