Our thinking


Download a file with PowerShell for Windows Server Core

If you’ve got a Windows Server without the Desktop Experience (which, in Windows Server 1709 is the default, and only option) then you’re going to have to get used to managing things from the command line.

When you initially log in, you’re greeted with a black desktop and a CMD prompt. Type powershell to change to the PowerShell command processor and you’re ready to get started.

You’ll need to find out the URL to the file you want to download using a browser on another machine. When you have the URL you need, head back over into PowerShell and enter the following

$url = "http://example.com/download.msi"
$Destination="\Users\serveradmin\Downloads\download.msi"
Invoke-WebRequest -uri $url -OutFile $destination -UseBasicParsing

There is a shorthand version of Invoke-WebRequest as iwr.

So, to download the SQL Server Express installer for example, type in:

iwr -uri https://go.microsoft.com/fwlink/?linkid=853017 -OutFile ./SQLServer2017-SSEI-Expr.exe -UseBasicParsing

This will download the installer .exe to your current directory in PowerShell.

Leave a Reply