Downloading files with windows server core

I found out that the invoke-webrequest doesn’t work so well on windows core. The Internet Explorer einginre required by the ParseHtml is apparently not supported on Server Core editions of windows Servers. If you want to do web page parsing on Server Core, be sure to use the -UseBasicParsing as a parameter of the request.

This mode performs only limited parsing on the uri – images, input fields, links and raw html content.

So in order to download onto your internet connected windows Core Server, you can use

$url = "http://myfiles.com/download.msi"

$Destination=".\download.msi"

Invoke-WebRequest -uri $url -OutFile $destination 

more practically if I wanted to download a hotfix, I’d go

> iwr -Uri http://download.microsoft.com/download/F/3
/6/F365E995-0C73-48D6-B520-3FF323CA913A/Windows8.1-KB2979576-x64.msu -UseBasicParsing -OutFile .\Windows8.1-KB2979576-x64.msu

Also for some type of file you might want to use the Unblock-File powershell cmdlet.

Advertisements

#2012r2, #core, #download, #invoke-webrequest, #powershell, #windows-core