I am running an Invoke-WebRequest
in a Windows Powershell as an Administrator.
When I run the following command: Invoke-WebRequest http://speedtest.newark.linode.com/100MB-newark.bin -OutFile $env:TEMP
(as recommended here), I get an error stating Access to Path is Denied
(see image below).
Things I tried that didn't work:
- Ran the command on Windows Server 2008 and 2012, as well as, Windows 8.1.
- Unchecked the
Read-Only
setting permissions under theTemp
folders properties. - I changed
$env:TEMP
toC:\
.
The error is consistent across all operating systems tested.
It looks like you are getting an access denied because the OutFile parameter is trying to create a file named TEMP in AppData/Local folder but there is already a directory named TEMP so there is a naming conflict. I received the same error running your command as is, then I added a file name and it worked. See below:
Your command works on my System (Windows-7 SP1 x64). Running as regular User and Administrator both work... (Seems risky as Administrator though). I Tested both x86 and x64 versions of Powershell
Here is the nifty little Get-Webfile function I used: Add to your $PROFILE or . source it. :)
** Perhaps a Measure-Command could be (more) useful somewhere in that pipeline to provide speed.