Some have already seen this error before while others are confused by it appearing when running their script.
I am talking about an error occurring when using the Webclient object in Powershell to download or upload files.
To be specific ... this one:
An exception occurred during a WebClient request.
Just to recap how the Webclient download/upload method works.
Now.. we have a few ways to troubleshoot this issue.
Make sure the download link works.
Fill it in on a browser and see whether it starts a download.
Make sure the download path is reachable (permission-wise) and exists
Check whether there is access to the folder
Make sure the paths are correct
Make sure both the source link and the destination both end with the filename.filetype. If either of them ends with a folder, there is a good chance it will end in a failure.
Check the extended message in InnerException to see more specifics.
Example underneath. Test command from above is set in bold:
Check the security of the download/upload-URLs
This is one I have not seen mentioned much as it relies mostly on how the security of the domain/network is set up.
A company with tight security might not allow http:// through this method. So if the URLs you are using start with http://, try setting it to https:// instead if possible.
Try it with a different command
Test whether you are able to download or upload the file through other commands.
An example for a download method would be:
Invoke-WebRequest -Uri SOURCEURL -OutFile DESTINATION
Hopefully this will be of use in fighting this error when it occurs!
Catergories: Powershell, Script, Troubleshooting
Patrick Berger AKA Powershellder.
[ i ] Parallax section below. Click on the section below to upload image. Don't worry if it looks weird in the Weebly editor. It'll look normal on your published site.
To edit or delete your image, press the "toggle" button below. Then, hover over your image until a popup appears with the "edit" and "delete" options. If you don't want a white content section, leave it blank. It will disappear on your live website.