I have a powershell script to download a large zip file using SFTP protocol and WinSCP that I'm having trouble with. I've got a lot of issues I'm trying to resolve with this but the main one is this... When I first started running it manually, it worked wonderfully. The past few weeks, though, it's like it can't seem to complete the download...
The script runs successfully. I see the zip on the destination NAS. When I try to extract the file, though, I get an error and the file is only 1 KB. When I manually download the zip through the WinSCP GUI, I see what I manually downloaded it is actually slightly smaller (105k) than the version powershell downloaded (106k), and I can extract the file without error.
This is very confusing to me. I'm not sure why powershell would increase a zip size during the download process but I'm sure it's related to the extract error I'm getting. And as I said above, the powershell script worked fine for a month before it started having this problem.
Any thoughts on what I should be looking at?
June 23, 2021 at 4:07 pm
It would help if we could see the code you are using - and any error messages. I use WinSCP to upload files within an SSIS package - and use the .NET control to do the work. If you are not using the .NET version - it might be a better option and you can review here: https://winscp.net/eng/docs/library_powershell
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
make sure the powershell version is setting the "Binary" mode for transfer - if not and if the default is not binary it will mess it up.
June 23, 2021 at 6:36 pm
To be honest, it sounds to me that the file at the source is damaged.
--Jeff Moden
Change is inevitable... Change for the better is not.
June 25, 2021 at 12:34 pm
make sure the powershell version is setting the "Binary" mode for transfer - if not and if the default is not binary it will mess it up.
Oh, good grief. I didn't even notice that the script somehow changed from Binary to Ascii. Thank you!
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy