Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

Problem with Invoke-WebRequest

$
0
0

I'm trying to download files from an array into a specific folder but getting a Server error 404.

Invoke-WebRequest : Server Error 404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable. At C:\temp\SyncRepo.ps1:109 char:21 + Invoke-WebRequest -Uri "http://wsu-rover/2008/x86/$i" -Outfi ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

$MissingFiles=$RemoteFileValue | Where-Object {-not$LocalFileValue.Contains($_)}

ForEach($iin$MissingFiles)

{
Write-Host"What is $i "

Invoke-WebRequest-Uri"http://wsu-rover/2008/x86/$i"-Outfile"E:\WSU_REPO\2008\x86\$i"-Method Get

}

$MissingFiles returns a list of files.

The $i prints the file correctly, but when in the invoke-webrequest it does not work. I'm giving in the full path of the folder in the -Uri and the -Outfile. What could be the issue? I'm stumped here. Please help! Thanks!


Viewing all articles
Browse latest Browse all 8411

Latest Images

Trending Articles



Latest Images