none
Updating Default Apps / Protocol via PowerShell

    Question

  • 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.

    • Moved by jrv Tuesday, May 15, 2018 9:17 PM correct forum
    Tuesday, May 15, 2018 8:36 PM

All replies

  • 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

    PSGallery:

    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!




    Tuesday, May 15, 2018 8:56 PM
  • To lock down mail and browser apps use Group Policy.  Post in GP forum for assistance.

    \_(ツ)_/

    Tuesday, May 15, 2018 9:17 PM
  • 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.

    Thanks

    Tuesday, May 15, 2018 11:54 PM
  • 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

    Tuesday, May 15, 2018 11:56 PM
  • 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. 


    \_(ツ)_/

    Wednesday, May 16, 2018 12:04 AM
  • 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.


    \_(ツ)_/



    • Edited by jrv Wednesday, May 16, 2018 12:12 AM
    Wednesday, May 16, 2018 12:10 AM
  • 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!

    Wednesday, May 16, 2018 7:37 PM
  • 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.

    Thursday, May 17, 2018 12:04 AM
  • I have escalated to Support. I am interested to hear what they say. Will update as we resolve through this issue.

    Thanks all

    Thursday, May 17, 2018 9:18 PM