Albert Widjaja
asked on
Modifying PowerShell script to automate download of
I had this question after viewing Powershell to download file from series of URL.
Hi All,
Can anyone please assist me with the below PowerShell Script that I can use to test file published on the webserver ?
The Test-URI function can be accessed from: https://www.petri.com/testing-uris-urls-powershell
Any help would be greatly appreciated.
Thanks,
Hi All,
Can anyone please assist me with the below PowerShell Script that I can use to test file published on the webserver ?
The Test-URI function can be accessed from: https://www.petri.com/testing-uris-urls-powershell
$target="C:\UAT\Files";
$WebClient = New-Object System.Net.WebClient
$MaxFileLimit = 1200
For ($i=1; $i -le $MaxFileLimit; $i++) {
$url = (-join("http://Submission.MyCompany.com/view.php?mod=url&id=$i"));
test-uri $url -detail -ErrorAction SilentlyContinue;
$WebClient.DownloadFile($url, $target);
}
Any help would be greatly appreciated.
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I have recommended this question be closed as follows:
Accept: David Johnson CD MVP (https:#a42449052)
If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.
exchangepro
Experts-Exchange Cleanup Volunteer
I have recommended this question be closed as follows:
Accept: David Johnson CD MVP (https:#a42449052)
If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.
exchangepro
Experts-Exchange Cleanup Volunteer
ASKER
When I put the script you've suggested and the Test-URI into the single page on the Windows PowerShell ISE I ran as Administrator, there is nothing reported on the screen, nor anything downloaded into the C:\UAT\Files directory?
When I copy pasted the multiple URL manually below to the new browser on the different PC:
http://Submission.MyCompany.com/view.php?mod=url&id=1000
http://Submission.MyCompany.com/view.php?mod=url&id=1001
http://Submission.MyCompany.com/view.php?mod=url&id=1010
...
http://Submission.MyCompany.com/view.php?mod=url&id=2001
I can download the files manually one by one.