Set Microsoft Edge as Default Browser One Time

The New Microsoft Edge browser is great and everyone should use it :) Especially if you’re still on Internet Explorer, you can make Edge use IE mode for the sites you have that still require IE, without having to actually use IE.

I had a scenario where I wanted Internet Explorer users to be changed to Microsoft Edge. Previously, we’d had business requirements to set IE as the default – but now that’s no longer required, I wanted to flip their default. At the same time, I didn’t want to change Google Chrome default browser users as they’d already made that choice, and didn’t want to shove a similar Chromium browser down their throats.

As per Microsoft’s doco https://docs.microsoft.com/en-us/deployedge/edge-default-browser you can use an XML file with default associations, and use Group Policy to point to that XML. It doesn’t stop users from changing the associations, but it does reset the associations each time the user logs in – so not ideal if you want to set a default, but also allow flexibility.

I worked out how to do this based on current default browser and using GPO still, so here’s what I did:

As per the doco above, create an XML file that sets Microsoft Edge as the default application for certain protocols:

<?xml version="1.0" encoding="UTF-8"?>
<DefaultAssociations> 
  <Association ApplicationName="Microsoft Edge" ProgId="MSEdgeHTM" Identifier=".html"/>
  <Association ApplicationName="Microsoft Edge" ProgId="MSEdgeHTM" Identifier=".htm"/>
  <Association ApplicationName="Microsoft Edge" ProgId="MSEdgeHTM" Identifier="http"/>
  <Association ApplicationName="Microsoft Edge" ProgId="MSEdgeHTM" Identifier="https"/>  
  <Association ApplicationName="Microsoft Edge" ProgId="MSEdgePDF" Identifier=".pdf"/>
</DefaultAssociations>

Note that .PDF is included, so if you’d rather not default .PDF files to Microsoft Edge, remove that line from the code.

The Group Policy in the doco to set this XML is called Set a default associations configuration file – and all it’s doing is populating a registry key. Instead of using the Group Policy setting, create a registry setting to apply a value to:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System
DefaultAssociationsConfiguration - REG_SZ - Path to XML e.g. \\dfs\share\defaultapplication.xml

The Group Policy registry setting will look like this:

We only want this registry setting to apply when the default browser is IE, and not apply any other time. We can use two options to do this – Remove this item when it is no longer applied, and Item-level targeting:

“Remove this item when it is no longer applied” will remove the registry setting when the item-level targeting condition is no longer true, which will stop the default browser applying again and again once the default browser isn’t IE.

“Item-level Targeting” is where we’ll check another registry value to see if IE is the default browser.

This is checking the registry key path Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice

and the Value name ProgId

and the Value Data IE.HTTP

Only when all this is true, will the XML reg key apply. Next time someone logs on, the default program associations file will be read and apply the new browser default. Then, next time Group Policy evaluates, the registry setting will be out of scope and removed, so the default program assocations file registry setting will be removed.

For reference, Chrome will be the value ChromeHTML and Edge will be MSEdgeHTM.

This method worked quite well and gave me what I was after – a one time change from Internet Explorer to Microsoft Edge, without bothering Chrome and Firefox users.

Note that this will also keep kicking in if the user changes their browser default back to Internet Explorer, which might be what you want – but if not, you’d need to add another Item-level target using a flag file or registry setting to mark that the default browser has already been applied once.

7 thoughts on “Set Microsoft Edge as Default Browser One Time

  1. I think you have a typo somewhere as you state this “Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System” but then the image shows that you are going to HKEY_CURRENT_USER. This path does not exists under “HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\System”.

  2. First of all, thank you for the great article.

    I also had problem with varied values.
    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System – is correct path in registry.
    \\domain\share\nameoffile.xml – this confused me a bit, so I changed it to default in windows. defaultassociations.xml, but in the end, I do not think this matters, it’s just gathering info. This threw me off a bit, hopefully you can edit the values to match or this comment helps someone else in doubt.

    – Sudomaso

    P.S. if you would like to have file in local location, create new GPO with file transfer and transfer defaultassociations.xml to C:\windows\system32\defaultassociations.xml and alter this GPO accordingly.

  3. Just noting for others who are looking at this as a solution, I don’t think this works anymore. The reason being that if you create the registry preference in Computer Configuration as per this procedure, the drop down list does not display HKEY_CURRENT_USER as per the screenshot, it shows HKEY_CURRENT-USER(HKU\.DEFAULT).

    The item level targeting editor when you create a HKLM key but set a HKCU value to test for eligibility converts the value to HKCU (HKU\.DEFAULT). It successfully applies the key to the default user hive, and every new user get’s the key applied to their profiles, but it doesn’t affect users with current profiles.

    Perhaps this did work/does work with an older/newer OS for your GP console (I’m using Server 2019), but it appears not to work at the moment. I’m about to give up on GP registry and going with a scripted powershell option

    1. Agreed. I’ve been trying to set this same setting now for about a week, in preparation to do away with IE in our environment. Everything we’ve tried, short of setting this as a policy and not a preference to force on all our users, just does not work as advertised. Main OS for us in Win10 1909 and it doesn’t seem to work at all.

      1. @Mark Fockler, cracked it.

        You need to follow the above process but it has to be a USER policy, not Computer. The itemlevel targeting correctly identifies HKCU (rather than .default) and the direction to the xml file setting correctly appears/disappears from the HKLM reg depending on the default browser (eg. only appears if IE is the default browser, disappears for Edge/Firefox etc).

        I’m honestly kicking myself for not trying this sooner but I got sidetracked into trying to solve this with powershell before testing the user policy component.

  4. @Grant, I am trying to follow steps that you mentioned, however not able to set Edge as default.
    Is there anything else I need to check

  5. *** ARTICLE FIX ***
    Firstly, thank you very much Adam Fowler, your article solved my issue (no idea why MS has made this so complex to do).

    Grant McKinney hit the key parts but I still found the above confusing for a bit, so I’m hoping the below helps clarify for those that are initially confused like I was.
    -USER POLICY: This is a User Configuration\Preferences\Windows Settings\Registry setting (not computer)
    -Hive Field: The Hive must be HKEY_LOCAL_MACHINE, the article has an error saying HKEY_CURRENT_USER
    Note: Setting it to HKCU sets it here which I don’t believe actually does anything: HKCU\SOFTWARE\Policies\Microsoft\Windows\System\DefaultAssociationsConfiguration

    The rest is clear enough in the document, the Item-Level Targeting *DOES* go to HKCU to do the check.

    Doing it this way makes it work like the author says. Watching procmon and through my tests here’s how it goes:
    -User logs on that has HKCU…http\UserChoice\ProgId set to IE.HTTP, the registry entry is created and their default changed. This registry setting then remains there until the next user logon)
    -Next user logging on, if their HKCU…http\UserChoice\ProgId does *not* match IE.HTTP it removes the registry key (so their settings do *not* get overwritten).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.