Setting default browser with powershell without 'How do you want to open this?' prompts

1.5k views Asked by At

all,

I recently tried to setup edge as a default bowser in a login script.

#Edge
Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice' -name ProgId IE.HTTP
Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice' -name ProgId IE.HTTPS

#Chrome
# Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice' -name ProgId ChromeHTML
# Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice' -name ProgId ChromeHTML

However, when I attempt to open a link in an email, I get a prompt on 'how I would like to open this? ' no matter which browser I set as default?

How do you want to open this?

Is is possible to set a registry key to turn off these prompts in windows?

Ta,

X

1

There are 1 answers

0
mklement0 On

Note: I'm unsure if the following will solve your problem, but it's better to use a ProgId value of MSEdgeHTM for Microsoft Edge (for both http:// and https://):

'http', 'https' | ForEach-Object {
  $regPath = "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\$_\UserChoice"
  Set-ItemProperty $regPath ProgId MSEdgeHTM
}

Note:

  • At least in URL shortcuts and Start-Process calls with URLs the above is effective for me on my Windows 11 22H2 system, without prompting.

  • However, you will get a Select an app to open this .<ext> file dialog on opening HTML files.