SetDefaultBrowser – Set the Default Browser per command line or script

UPDATE 24.10.2018 – Version 1.3 is completely coded from scratch. New features: Supports ALL Browsers (any installed Browser, portable Browsers, App-V Browsers, AppData Browsers, etc.), start delay option added, full Unicode support, includes EULA.

UPDATE 16.12.2017 – Version 1.2 now supports Windows 8/8.1 and Server 2012/R2.

UPDATE 10.12.2017running Windows 1703 and newer, you can now use my SetUserFTA utility to change the default browser. Just make sure you set .htm. html, http and https properly. 

if you are into XenApp, RDS or VDI, then you probably know how difficult it is to configure the environment properly for the enduser nowadays. in my latest blog article, i showed you how to configure File Type Associations per User. based on this previous work i have created a utility that can do the same for the Default Browser.

the story behind is pretty much the same, but to set a Browser, additional Registry Keys are needed (they are protected with the hash just like the file types). the only difference is, that Microsoft also checks the path of the Browser – on certain Windows builds. for that reason i decided to create a separate tool to make it as simple as possible.

newer windows builds don’t check the path of the browser anymore and therefore the hash changed too – but i have updated my tool to support following operating systems:

  • Windows 10 x86/x64 Build 1607, 1703, 1709, 1803, 1809
  • Server 2016 Build 1607
  • Server 2019 Build 1809
  • Windows 8 and 8.1
  • Server 2012 and 2012 R2

if you want to know more about the technical details, please read my previous blog post.

how to use

its really simple. just run SetDefaultBrowser.exe in the user context (there is a list of possible ways in my previous blog) with the the hive and browser of your choice. Since the version 1.3 there are more parameters and it might look complicated, but it gives you actually much more flexibility. Just run SetDefaultBrowser without parameters to get a list of all available browsers:

as you can see, i have a ton of Browsers on my system and using the following examples i can change the default Browser:

  • SetDefaultBrowser.exe HKLM Firefox-308046B0AF4A39CB
  • this will set the x64 Firefox as my default
  • SetDefaultBrowser HKCU “Google Chrome.HEYY3KJOYOAJOPVCHWOFAPMTPI”
  • this will set the Chrome that is only installed in my AppData as my default
  • SetDefaultBrowser.exe HKLM Edge delay=1000
  • this will set Edge as my default browser, but will wait 1 second until it executes. delay must be provided in milliseconds.
  • SetDefaultBrowser.exe HKLM IEXPLORE.EXE group=IE_Users
  • this will set IE as my default Browser, if i am member of the IE_Users group

i hope these examples explain the possibilities and parameters clearly. if a browser identifier contains a space, you must use quotes – for example “Google Chrome”. the same applies to group names (but you also can use Domain\Group or group@yourdomain.tld).

to maintain limited compatibility with the older versions of SetDefaultBrowser, i have added shortcuts to the most used Browsers

  • SetDefaultBrowser.exe chrome
  • this will set Chrome as my default Browser, when its available in HKLM
  • SetDefaultBrowser.exe ie delay=2000
  • this will set Internet Explorer as my default Browser but delays two seconds before
  • SetDefaultBrowser edge group=EdgeUsers
  • this will make Edge the default if the user is member of the EdgeUsers group

available shortcuts are: chrome, ie, iexplore and edge. i had to skip Firefox, since you can have multiple Firefox installations (for example x64 and x86, like on the screenshot above) and using the hive and browser parameter, you can better specify which one you want to set as default.

SetDefaultBrowser will also find the browser when it is not installed at the default path.

the easiest way in an enterprise environment is to use the Group Policy Logon Script feature (you need loopback mode activated, when deploying to computers) – but there are many other ways (check the SetUserFTA blog for more ideas).

IMPORTANT: a portable Browser must be registered in the registry first to work with SetDefaultBrowser. I will write a blog article about how to do that soon.

additional info

if you still see this screen after you used SetDefaultBrowser:

then try this registry key (needs an explorer.exe restart or just a re-login):

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer]
“NoNewAppAlert”=dword:00000001

this registry key also works with HKEY_CURRENT_USER!

or enable the GPO Do not show the ‘new application installed’ notification (Windows Components, File Explorer).

bugs? requests?

if you find a bug or have a special request, you can send me an email to bugs@ mydomain (the one in the browser address bar).

download

download SetDefaultBrowser v1.3 here. SHA265 hashes below.

.exe:CE49E5864A15CE0ADF99A93C6923E9AE34E5EC2C906EB5E6588D433364576C23
.zip:7AA596EFEF5635589DA4CEBA36DFA9555DEAB6DF5093BE109B1CA5EEF6C63681

Version 1.0 – first public version
Version 1.0.1 – additional Firefox detection
Version 1.1 – now working on Windows 1703 and 1709, opera support added
Version 1.2 – support for Windows 8.x and Server 2012/R2 added
Version 1.3 – support for ALL Browsers, delayed start, full Unicode, EULA

keep the project and this blog alive – please consider donating:

if you prefer cryptocurrencies, please contact me for the details.

Thank you!

91 Comments

  1. great tool – one question though is there a way to force the browser and then not have Windows ask if I am sure I want to use my new default browser the first time I open it? (basically auto check the box)

    • my tool is supposed to do exactly that. if it doesnt work, the machine is in an inconsistent state. this can happen when you install additional browsers – ive seen that during my testing. if you use the *reset to the microsoft recommended defaults” button in the settings app, it should fix that and SetDefaultBrowser works as expected. which OS are you on and which browser are you trying to set as default?

    • i found out that this happens sometimes after you install a new browser, because HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts does not contain all needed registry keys. if you want to automate this, just select once your desired browser in the Microsoft popup dialog and then export the created associations (for example ChromeHTML_http, ChromeHTML_https, etc.)

  2. Seems to work after a new profile was created – thanks 🙂

    Just need to now get Defender and other AV solutions not delete any of your tools ! As they get auto removed without exceptions – looks like they all contain issues ?

  3. Great program, only issue I have is that when you set chrome as the default browser in windows 10 with this utility it also sets chrome as the default for .pdf files , is there an option to supress that ??

    • on which build is that? actually SetDefaultBrowser does not change anything related to PDF – it changes only .htm, .html, http and https handlers.

      but you could run “SetUserFTA .pdf AcroExch.Document.DC” after SetDefaultBrowser to make Acrobat Reader the default app for .pdf’s for example.

      • it’s windows 10 1607, doesn’t happen to all users either , this particular one logs into chrome with a google account.
        I ended up using the SetUSerFTA as you mentioned in the reply and that seems to work .

  4. Could you add Vivaldi to your list of supported browsers? It launches from C:\Program Files (x86)\Vivaldi\Application\vivaldi.exe and is a chrome based browser.

  5. In the SetUserFTA post, you stated that if one wants to change the Mailto protocol on windows 10 1607 build to use this SetDefaultbrowser.exe. Is there a way to just set the mailto protocol to a non browser. example default mailto is set to Mail (Windows Mail), but if using outlook 2016. you had mentioned about creating a single exe that would just change MailTo. is that ready for prime time?

  6. I really love this little gem of a program!! Thank you very much for it!! One request though… When setting Chrome as the default browser, it also sets pdf files to be opened by Chrome too. Can this be changed to not change my default pdf associations?

    • i dont know why this happens, but other people reported it aswell. my app does not touch the .pdf extension at all, this must be caused by a previous configuration in the registry. but you can simply run SetUserFTA after the SetDefaultBrowser to assign the .pdf filetype to whatever you want – instead of chrome.

  7. Great program, thanks so much for cracking this one!

    Can you please explain how to use this to setup Citrix Metaframe Server FTA for client side browser redirection?

    We are hoping to get this to work for Server 2016 and have ServerFTAHTML be the default for http and https so that it defaults to the user’s local browser, but it keeps falling back to iexplore.exe within the user’s session by default after logging into a fresh session. We are currently using an XML file to populate the default file associations, but it isn’t working for all users so we were hoping to use your program instead to set the hash correctly.

    This is the hash and ProgId location for http and https:

    HKEY_USERS\\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice
    HKEY_USERS\\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice

    Any help you can provide would be greatly appreciated 🙂

      • Thanks for the quick response. Redirection from a http/https link clicked within a Citrix session to the user’s local browser. This used to work in Windows 2012 R2 using GPO and an XML file with default file associations, but isn’t working anymore for some users in Windows 2016.

          • Thanks for the great article, however this is already how we have implemented it. It appears that some users have somehow lost their ServerFTAHTML file type association in the following location and it’s breaking Host to Client browser redirection:

            HKEY_USERS\\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice\

            It’s setting ProgId to “IE.HTTP”, but it should be “ServerFTAHTML”

            Do you have a way that we can create a custom browser type so that we can use your SetDefaultBrowser application to set this value with the correct Hash so that it persists between sessions?

            All other values in the article you mentioned seem to persist, but this is the one that breaks and always reverts back to IE.HTTP or IE.HTTPS

          • that should be possible aswell yeah, but if this gets overwritten you most likely have a appassoc.xml in place. which profile solution are you using? and on which operating system are you working? Server 2016?

  8. If you could walk us through how to use your application to set this at login it would be much appreciated. We only started experiencing the issue once migrating to server 2016. We use the same XML config as the one used in the Citrix article you quoted. We use profile redirection and wipe profiles off the VDA on log out. So depending on what persists we would have to recreate it on login. It could be an issue with the XML, but we’ve set it up as instructed. It could also be related to the latest patches breaking the FTA as you mentioned on your blog?

    • ok… please try this: add these registry keys to your Server and then ServerFTA will appear when running SetDefaultBrowser. you can then set it as default with “SetDefaultBrowser HKLM ServerFTA”.

      Windows Registry Editor Version 5.00

      [HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\ServerFTA]

      [HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\ServerFTA\Capabilities]
      “ApplicationDescription”=”Citrix ServerFTA”
      “ApplicationIcon”=”C:\\Program Files (x86)\\Citrix\\system32\\iexplore.exe,0”
      “ApplicationName”=”ServerFTA”

      [HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\ServerFTA\Capabilities\Startmenu]
      “StartMenuInternet”=”ServerFTA”

      [HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\ServerFTA\Capabilities\FileAssociations]
      “.htm”=”ServerFTAHTML”
      “.html”=”ServerFTAHTML”

      [HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\ServerFTA\Capabilities\URLAssociations]
      “http”=”ServerFTAHTML”
      “https”=”ServerFTAHTML”

      [HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\ServerFTA\shell]

      [HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\ServerFTA\shell\open]

      [HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\ServerFTA\shell\open\command]
      @=”\”C:\\Program Files (x86)\\Citrix\\system32\\iexplore.exe\””

      • That did the trick!

        You’re a bloody legend 🙂

        The only change I made was the first line to this:

        [HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\ServerFTA]
        @=”ServerFTA”

        Probably doesn’t actually make any difference to be honest, but after adding all the suggested registry keys and then running SetDefaultBrowser HKLM ServerFTA it fixed the stuck users and now the default XLA Citrix Server to Client redirect GPO is working as it should.

        Thank you so much for your help with this and being such an amazing knight in shining armour, battling the frustration that is Microsoft!

        • im glad it worked. important are FileAssociations and URLAssociations – now it will even redirect .htm and .html files to the client. if you dont want this, use SetUserFTA to change it back to the IE on citrix. cheers!

  9. Sorry, I am pretty much a newbie at this. Here is what I am needing: I would like to create a GPO that runs SetDefaultBrowser.exe upon logon for each user, and I would like the .exe to always default to setting Chrome. How can I accomplish this? I love the tool that you built and it is working flawlessly when done manually, but I need to push it out to a few hundred laptops and thin-clients. I know I need to make a logon script and put the .exe on a server/share that all users can access, but I am having trouble with making the script choose chrome without intervention and pointing it correctly. Thank you!

    • just run “SetDefaultBrowser.exe chrome” with a script or a policy. if it doesnt work, it might be a timing problem. then you can use “SetDefaultBrowser.exe chrome delay=2000” to run it two seconds later. check my blog from SetUserFTA under the section “how can i deploy this” for more ideas how to run this on multiple machines. there is also an example with screenshots for the gpo configuration.

  10. Hi Christoph,
    It seems not all users are created equal..
    We have noticed a very puzzling issue with the following path in the registry:

    HKEY_USERS\\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache

    When ServerFTAHTML is present for the user and server to client URL redirection is working, the following entries exist in the above location:

    Name: C:\Program Files (x86)\Citrix\system32\iexplore.exe.ApplicationCompany
    Data: Citrix Systems, Inc.
    Name: C:\Program Files (x86)\Citrix\system32\iexplore.exe.FriendlyAppName
    Data: Citrix Metaframe Server FTA

    When they are not present, ServerFTAHTML is replaced by IE.HTTP and IE.HTTPS respectively (at the following locations:

    HKEY_USERS\\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice
    HKEY_USERS\\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice

    Do you know why this might be?

    • hm.. no idea. but that key is not roamed with citrix UPM btw. and is part of the UsrClass.dat – if that makes any sense in your setup. what if you just create those registry keys with a GPO on every login? and what if you run SetDefaultBrowser with the delay option to overwrite IE.HTTP again?

  11. So it looks like it might have been a fluke when I got it working before. Whenever I run the SetDefaultBrowser now to ServerFTA, this is after login, manually run on the server they have landed on in the context of their user, it just gives the user the popup screen asking them to choose their default browser, which would be the same effect if I had deleted or altered the http/https entry under:

    HKEY_USERS\\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice

    So that would answer your question about running it with a delay, not working.

    I am still investigating the idea of incorporating the UsrClass.dat, but I don’t think that’s how we want it to work as we want to force the same browser for all users every time (their local browser with Server to Client redirect) and not give them the choice.

    It might be time to log a case with Citrix 🙁

    Do you know why your SetDefaultBrowser application would be failing to set the values under these keys correctly and thus prompting the user to choose a default browser after clicking on a hyperlink?

    HKEY_USERS\\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice
    HKEY_USERS\\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice

    • UsrClass.dat roaming is not supported with Citrix UPM. it will break the start menu if you have full desktops.

      but the message you are seeing is because Windows noticed that there is a new handler for http/https and therefore asks the user to select again. you can disable that “feature” with this policy: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.WindowsExplorer::NoNewAppAlert

      this message appears, even when the hash is correct.

      • Hi Christoph,

        Sorry for the delay in getting back to you.

        The key mentioned in that link is already “enabled” so it might be something else.
        HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer\NoNewAppAlert
        Value=1

        It’s been really busy at work lately, so I’ll try to keep troubleshooting this closer to Xmas when things start to quiet down. Thanks again for all your help 🙂

          • Hi Christoph, We already have the October 18, 2018 update (KB4462928) on our Windows 2016 VDA which includes the KB4051033 update. Interestingly if I remove the UserChoice Value Data for Hash and ProgId for http and https under HKEY_USERS\\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\

            then run the SetDefaultBrowser program as the user, the values are added back, but with a different Hash and as soon as an attempt is made by the user to launch a url using the browser from within the Citrix session, ALL entries under the UserChoice key are deleted for the link I launched eg. In my case http://google.com, however this redirected to https so the http key was untouched and only the https key was wiped and the user is prompted to choose a default browser. At which point they can choose Citrix MetaFrame HTML, which recreates the data, again with different hashes and the user is then able to redirect to their local browser. This however, does not persist between sessions and on login is set back to IE.HTTP and IE.HTTPS.

            I hope that makes sense?

          • yes – that makes sense. first of all – the hash will ALWAYS change when you use SetDefaultBrowser and also when you change the browser manually. this is by design. but when the entries get deleted from the UserChoice key, the hash was not correct and then you get the popup to select your default browser.

            this means, something in the setup from my registry key is not correct. it is really important, that this part is pointing to the correct location:

            [HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\ServerFTA\shell\open\command]
            @=”\”C:\\Program Files (x86)\\Citrix\\system32\\iexplore.exe\””

            this must be the same path as you can find under HKEY_CLASSES_ROOT\ServerFTAHTML\shell\open\command

            if you want to roam these settings, you must use Citrix UPM or a similar profile solution. its important that you can roam the NTUSER.DAT file completely. you can not export/import these keys manually, because it will change the hash.

  12. Hi Christoph,

    Thank you for the quick response. There does appear to be minor discrepancy between the values in those two locations. Please see below:

    HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\ServerFTA\shell\open\command
    ”C:\Program Files (x86)\Citrix\system32\iexplore.exe”

    HKEY_CLASSES_ROOT\ServerFTAHTML\shell\open\command
    (Default) Value=”C:\Program Files (x86)\Citrix\system32\iexplore.exe” %1

    Please note the “%1” at the end of the second location. Would this make a difference?

    • that is ok. i noticed, when you copy paste the reg file from my blog, it does not set the path correctly, because of the ” characters that the blog formats in a different way.

      anyway – i have tested it now on a Server 2016 and it works as expected. when you run SetDefaultBrowser without any parameter, it should display the ServerFTA. is that working? it should look like this (showing the path):

      Installed browsers:
      ===================

      HKLM IEXPLORE.EXE
      name: Internet Explorer
      path: C:\Program Files\Internet Explorer\iexplore.exe

      HKLM ServerFTA
      name: ServerFTA
      path: “C:\Program Files (x86)\Citrix\system32\iexplore.exe”

3 Trackbacks / Pingbacks

  1. EUC Weekly Digest – November 11, 2017 – Carl Stalhood
  2. Dateiendungen automatisiert unter Windows 10 mit den gewünschten Applikationen verknüpfen ← Gunnar Haslinger
  3. SetDefaultBrowser – Set the Default Browser per command line or script – Bienvenue sur la KBelliot ;)

Leave a Reply