Updating Default Apps / Protocol via PowerShell


  • Greetings,

    Has anyone had experience in setting default apps or setting default apps by protocol using PowerShell?

    We have some challenges in our environment where users are changing their default apps, specifically mailto protocol, to use browsers, as oppose to Outlook.

    I searched for ways to do it through registry, but came across inconsistencies to which keys should be set. Was hoping for a way to do it programmatically that we can then push.

    Thanks in advance.

    • Cambiado jrv martes, 15 de mayo de 2018 21:17 correct forum
    martes, 15 de mayo de 2018 20:36

Todas las respuestas

  • Hi Virgil,

    Group Policy

    Already tried to use Group Policy to manage the file associations? For more information: Set the default browser using Group Policy.

    I think, GPO is better managing in file asseciations than using Powershell in this situation.

    Using Powershell

    Regarding my investigation, the UrlAssociations are stored in HHKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ with the Set-ItemProperty you can change the file association.

    For default browser:

    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


    How to associate file extensions with application on Windows by PowerShell

    I my opinion you can better use GPO to achieve your goal.

    Sincerely, Martien van Dijk. Please remember to mark the replies as answers if they help and unmark them if they provide no help. Check out My Blog!

    martes, 15 de mayo de 2018 20:56
  • To lock down mail and browser apps use Group Policy.  Post in GP forum for assistance.


    martes, 15 de mayo de 2018 21:17
  • Specifically, we were looking to set the mailto protocol.

    We decided on not using GPO as we currently have a mixed Office Suite Environment. So we do not want to blast a setting, since different devices will have different versions installed.

    That is why we believe a PowerShell script would suffice, as we can then code conditional statements based on what the user has installed.

    I would appreciate it if you can move this back to the PowerShell forum.


    martes, 15 de mayo de 2018 23:54
  • Thanks for the suggestions.

    We decided not to go through GPO as we have a mixed environment of Office install.

    We thought by coding conditional statements, we would be able to accommodate, the different versions.

    I will give the module, as well as the code you suggested, a try and will post back.

    thanks again

    martes, 15 de mayo de 2018 23:56
  • There is really no reliable way to do this short of a GPO.

    Default apps are set deep in the users hive and are not directly accessible as plain test or numeric settings. For later Windows versions they are not documented.

    Assigning  a third party mail service may not be possible outside of the GUI. 


    miércoles, 16 de mayo de 2018 0:04
  • This will get the current "mailto" setting.

    (Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\mailto\UserChoice' -Name ProgId).ProgID

    This is only available on Windows 10.

    Most third party mail apps do not have a registered ProgID so this will not work.


    • Editado jrv miércoles, 16 de mayo de 2018 0:12
    miércoles, 16 de mayo de 2018 0:10
  • Just checking if there is any update on this question. Can you provide us with an update?

    Sincerely, Martien van Dijk. Please remember to mark the replies as answers if they help and unmark them if they provide no help. Check out My Blog!

    miércoles, 16 de mayo de 2018 19:37
  • So here is what is interesting:

    If I update the Default Mail Application / mailto Protocol through the GUI to Outlook, the (Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\mailto\UserChoice' -Name ProgId).ProgId command suggested by jrv, will change accordingly.

    However when I set the key to Outlook using a Set-ItemProperty cmdlet, when I attempt to access a mailto link, I will receive a toast notification that there is an error and the mailto protocol will default back to the native Mail app.

    So it seems that by setting it through the GUI, there may be additional keys that may need to be changed.

    An additional note, that if I change the mail application to Outlook in the GUI, and I run a Dism /online /get-defaultappassociation command, I get the following for the mailto Association Identifier:

      <Association Identifier="mailto" ProgId="AppXydk58wgm44se4b399557yyyj1w7mbmvd" ApplicationName="Mail" ApplyOnUpgrade="true" />

    Seems like after updating it in the GUI, the mailto Association Identifier does not change as well.

    When I attempt to export the xml, I get a 80004002 error. DISM Log states that it Failed to export the user associations from the registry. I have not yet had the bandwidth to follow up.

    Finally, I tried to use the AssociateFileExtensions Module that was recommended. While it seems to have set using the following command

    AssociateFileExtensions -fileextensions mailto -openapppath "C:\Program Files (x86)\Microsoft Office\root\Office16\outlook.exe"

    Clicking mailto links will default to whatever I set in the Default Applications GUI.

    I am trying to play with Configuration Items in SCCM to default, but GPO maybe the way to go at this time. That or create documentation for our Client Base on how to set Defaults.

    It is an interesting exercise, but so far no suggestions have worked successfully.

    I do appreciate the suggestions.

    jueves, 17 de mayo de 2018 0:04
  • I have escalated to Support. I am interested to hear what they say. Will update as we resolve through this issue.

    Thanks all

    jueves, 17 de mayo de 2018 21:18
  • Wanted to provide an update on my progress. My issue with exporting the XML file has been resolved by installing KB4103714. This was part of the May 2018 Cumulative Updates.

    I am still experiencing, however, the issue where the appID for the mailto attrib does not change, upon export.

    I asked them to reach out to the other teams to see if it can still be managed through CIs / SCCM. I'd be interested to hear the response.

    Will update as necessary.

    Thanks all

    jueves, 14 de junio de 2018 17:17