共用方式為


Windows 10 – How to configure file associations for IT Pros?

Hello, my name is Ismaël Limbada and I am a Support Escalation Engineer for Windows Core Team. This blog post is about file association configuration in Windows 10. After reading it, you will be able to configure file associations in Windows 10 and avoid this notification: An app default was reset.

All steps described in this blog post have been tested on following Windows 10 versions:

  • Windows 10 1709
  • Windows 10 1703
  • Windows 10 1607

Configuring file association prior Windows 10

There were different ways and guidance to set default program prior to Windows 10 (see Managing Default Applications).

Before Windows 10, an application could check default apps, ask for user consent and set default app programmatically using Windows API.

But some programs skip the user consent and set the app defaults into the registry. The main requirement for default file association is often forgotten: the end-user is in control.

Now in Windows 10 checks if registry file extension keys have not been modified to prevent file association hijacking.

File association changes in Windows 10

The way that default file associations work changed in Windows 10.

There is a new UI for the end-user. This new way puts the user in control with a new file association notification.

This notification will be displayed:

  • On the first launch of a file extension, if multiples programs are registered for handling that file extension.
  • Each time a new application registers a file extension, except if the Always use this app to open .xxx files is checked.

If an application used Windows API to set default apps, the user will receive the following notification:

For more information about these changes : https://blogs.windows.com/windowsexperience/2015/05/20/announcing-windows-10-insider-preview-build-10122-for-pcs/

You will find some explanation on The Old New Thing blog: Why do my PDF file associations get reset every time I restart?

Windows 10: An app default was reset

But what happens if an application is not using Windows API and writes some stuff and hijacks user preferences?

Now,Windows 10 detects that the registry is corrupted and will reset the default program for this file extension. Additionally, the end-user will receive this notification: An App default was reset. These change is documented in KB4001770: Reset app default when a registry setting is deleted or corrupted and streamlined notification about the corruption.

In Windows 10, if you are using applications or scripts that tamper registry entries to configure default apps associations, you will get app reset notifications.

How to configure file association in Windows 10?

It's possible for IT Pro to configure or force default association using supported methods.

The best way to do it is to set up a reference computer, install applications, configure default programs and use Dism to export/import the custom default app associations or use a group policy.

  1. Set up a reference computer

  2. Install applications

  3. Go to Control Panel\All Control Panel Items\Default Programs and configure default apps associations. In Windows 10 1709, this control panel item is now in Settings app.

    Let's try to configure Internet Explorer as the default browser

    Choose Internet Explorer

    Internet Explorer is now the default web browser

  4. Export/import the custom default app association with dism.exe
    Note that you need administrator rights to use dism.exe. And to export properly the associations use the same account used in step 3, otherwise you will get a malformed XML file.

  1. Dism.exe /online /export-defaultappassociations:C:\temp\CustomFileAssoc.xml

PS C:\Windows\system32> dism /online /export-defaultappassociations:"C:\Temp\IE-DefaultBrowser.xml"

  1. Open the xml file and check if everything looks good.

Usually at this step you will be tempted to delete other lines because you simply don't care about them and get a file like this:

FTA-IE-Only.xml

VERY IMPORTANT: If you want to import your file with DISM.exe, DO NOT delete any file associations entries!
A missing entry will trigger the App default reset notification and you will get a notification storm at the first logon.

Refresh your XML on a regular basis

As some recommended applications can manage more extensions with each new Windows 10 version available, it's a good practice to refresh your XML. For example, in Windows 10 1703, Microsoft Edge registers the epub extension. If you're using an XML file from Windows 10 1607, epub is missing. As a result, you will get an app reset notification for epub.

Tips for building your XML file

  • Manually editing the file could result in a non-valid XML file. Ensure that your XML file is valid. Opening XML file in the old Internet Explorer is a good idea to check if the XML is valid. You can try XML Notepad to edit/validate XML files.
  • If you do not see your file extension in XML file, go back to Control Panel\All Control Panel Items\Default Programs and configure default apps associations, select file extension, click on Change Program and confirm the program in the dialog box. Then, export again you're XML file.

Deploy your custom XML

Now it's time to apply your XML file. You have two options:

  • Set up file association in your Windows 10 image. File associations will be configured for new users' profiles. Existing profiles are untouched. Users can change file associations.
  • Configure a policy for your domain-joined computer: file association will be configured at each logon. User will be able to change file association, but at the next logon file association will be configured using XML file. This policy works only for domain-joined computer.

Configure the XML file for your Windows 10 reference image:

Dism.exe /online /import-defaultappassociations:c:\temp\CustomFileAssoc.xml

Your file will be copied in \Windows\System32 with the following name OEMDefaultAssociations.xml

Configure the XML file for your domain-joined computer

Configure the following policy Set a default associations configuration file located in Computer\Policies\Administrative Templates\Windows Components\File Explorer.

If this group policy is enabled and the client machine is domain-joined, the file will be processed, and default associations will be applied at logon time.

Note: this policy will not prevent user to change the file association. But at each logon the default association configured in XML file will be applied.

How to force only a set of file associations?

Some IT Pros want to force only some file associations and let users in control for others file associations. For example, they want to configure Internet Explorer as default for HTTP/HTTPS only for HR people.

So, they removed everything in the XML file except Internet Explorer entries. As previously seen, removing entries in XML file could result in app reset notifications.

But don't panic, there is a solution to do it in your Windows 10 reference image.

You just need to have two XML files, one for configuring the defaults and another one to force file association.

The main XML, CustomDefaultAssoc.xml must contain all extensions. You need to import this file using:

Dism /online /import-defaultappassociations:C:\CustomDefaultAssoc.xml

The second XML, FTA-IE-Only.xml will contain only a set of file extensions. You need to use this XML file with the group policy Set a default associations configuration file.

 At the first logon, Explorer.exe will apply both XML.

The end user will have this results without any app reset notifications:

  • PDF files associated with Microsoft Reader.
  • HTM/HTML files associated with Internet Explorer.

OEMDefaultAssociations.xml contains the following lines:

IEOnly.xml contains the following lines:

Why I'm getting an app reset notification?

Raymond Chen talked about this problem. If a program is trying to set some registry keys, Explorer will detect it and the file association will be reset.

Stop using script or other pre-Windows 10 ways for configuring file association.

You can check the Microsoft-Windows-Shell-Core/AppDefaults event log for clues about file associations reset.

If you want to troubleshoot this, keep calm and run Procmon
😉

You should be able to track which application is hijacking your file associations. Once you identified the bad application, the best way to solve this, is to use a more recent version, or contact your vendor.

Why I'm getting the User Choice notification even if I used an XML file?

You could get the following notification starting Windows 10 1703 when you choose an application as the default viewer instead using Microsoft Edge.

These notification windows are displayed only once if you're clicking on OK. It's because Microsoft Edge is detected as a new application.

If a new app is installed and is registered to an existing file extension or protocol you will get this notification.

If you want to get rid of these notifications, there is a group policy to hide these notifications:

Do not show the 'new application installed' notification

This policy removes the end-user notification for new application associations. These associations are based on file types (e.g. *.txt) or protocols (e.g. http:) If this group policy is enabled, no notifications will be shown

You can find in the table below some group policies related to default file associations settings:

Policy Setting Name Policy Path
Do not reinitialize a pre-existing roamed user profile when it is loaded on a machine for the first time Windows Components\File Explorer
Turn off Internet File Association service System\Internet Communication Management\Internet Communication settings
Turn off access to the Store System\Internet Communication Management\Internet Communication settings
Do not show the 'new application installed' notification Windows Components\File Explorer
Set a default associations configuration file Windows Components\File Explorer

Bonus for Adobe Reader XI users

If you are still using Adobe Reader XI, you should get a new application to open PDF, as Adobe Reader XI is out of support.

With Adobe XI installer, you can get an app reset notification for PDF extensions and it will be reset to Microsoft Edge.

You should look at Adobe Reader documentation and launch the Adobe Reader 11 installation with the following command line:

AdbeRdr11010_en_US.exe /rs /sAll /msi EULA_ACCEPT=YES OWNERSHIP_STATE=0

With OWNERSHIP_STATE=0 Adobe Reader stops to change file association for PDF with an unsupported way.

Resources:

Comments

  • Anonymous
    October 25, 2017
    In a similar topic, how do I reduce the number of apps that are listed in "Open with..."
  • Anonymous
    October 25, 2017
    We prefer the old way and hate how cumbersome this new way is. If you don't do it perfectly, everything gets reset to the Microsoft inbox apps that nobody wants to use.Our users don't have administrative rights to install software so I'm really not worried about apps hijacking extensions. I wish we could just turn the whole new system completely off.
  • Anonymous
    October 25, 2017
    Thank you!!!
  • Anonymous
    October 26, 2017
    Has this changed under Release 1703? Under Release 1607, I Exported the associations to an shared XML normally. To test it, I simply used the /Import-DefaultAppAssociations switch with the XML file on another machine. For deployment, I created a step in our SCCM Task Sequence to run DISM and Import the XML file. But on 1703 this is not working. It creates the desired OEMDefaultAssociations file but does not apply any changes.
    • Anonymous
      November 01, 2017
      I found the same behavior with 1703. What was working with 1607 no longer worked with 1703 (at least with Adobe Reader). I've had a case open with MS for months on this.
  • Anonymous
    October 26, 2017
    Great article.. lots of good info. If you want to "point and shoot" your way to this, instead of dealing with DISM and having a "perfect machine" (and also if you want to have DIFFERENT XMLs per computer).. suggest you check this out, which relies upon the same XML mechanism, but adds a lot to it: https://www.policypak.com/products/policypak-file-associations-manager.html
  • Anonymous
    October 26, 2017
    thanks
  • Anonymous
    October 27, 2017
    Seriously, why is this simple task now so convoluted?Is this part of a MS strategy just to force enterprises to not modify the OS how they see fit.Consumer v Enterprise requirements will always be different, just don't keep making it hard for us
  • Anonymous
    November 05, 2017
    Brilliant article – answers a lot of my frustrations about the reset notifications and associations in general under Windows 10. Thanks.
  • Anonymous
    November 09, 2017
    It seems the old Default Programs option is still there somewhere in 1709, because Adobe Pro brought me there when it asked if I wanted to set it as the default upon installation. But you can't get there if you try to through Control Panel like you used to be able to. So Microsoft hasn't actually removed it, just made it really hard to get to. Anyone know how to still get to it since it's so much easier to set full defaults for a program with it? The new interface makes you change each item manually if you want it to have all defaults. That's not making it easier in my opinion.