DEV Community

Pete Freitag
Pete Freitag

Posted on • Originally published at petefreitag.com on

One liner to download a Browser with PowerShell on Windows Server

It would be nice if Windows Server 2019 came with Microsoft Edge Browser, but it still comes with good old IE 11, and on a Windows Server, you have to jump through hoops to let IE download anything due to its default security settings.

First I tried downloading Microsoft Edge Browser with IE on Windows Server 2019. I got the following prompt: Do you want to allow this website to open an app on your computer?, then when I click Allow it says:

You'll need a new app to open this microsoft-edge

Yes IE, I know!

My next attempt was to download Chrome on Windows Server 2019 using IE, it tells me:

Your current security settings do not allow this file to be downloaded.

Now I realize I could just make IE's security settings more lax, but I'd rather not do that on a server.

Finally before event attempting to download Firefox on Windows Server using IE, I though maybe I can just write a powershell script to download it, and bypass IE all together. It turns out this was quite a simple and successful endeavor. Just open up a new PowerShell session and run:

Invoke-WebRequest -Uri "https://download.mozilla.org/?product=firefox-msi-latest-ssl&os=win64&lang=en-US" -OutFile firefox.msi
Enter fullscreen mode Exit fullscreen mode

This powershell command will download the latest Firefox web browser and save it as firefox.msi in the current directory. You can then just run firefox.msi and you'll be on your way with a legit browser.

You could use the same technique to download Chrome or Edge on Windows Server 2019, you would just need a URL to download it first. Then swap the URL in the powershell script to point to the browser you want to use. No need to even open Internet Explorer on Windows Server.

Discussion (0)