Why don't you check before you run the script?
You probably do not share some constraints with us.
Anyway, if you insist on your approach, I recommend you to use WinSCP .NET assembly from PowerShell script:
https://winscp.net/eng/docs/library
https://winscp.net/eng/docs/library_powershell
https://winscp.net/eng/docs/library_session_getfiles#powershell
You probably do not share some constraints with us.
Anyway, if you insist on your approach, I recommend you to use WinSCP .NET assembly from PowerShell script:
https://winscp.net/eng/docs/library
https://winscp.net/eng/docs/library_powershell
https://winscp.net/eng/docs/library_session_getfiles#powershell