Behind Windows Setup & Deployment

I will use this blog to share knowledge mostly related with Windows Deployment and Setup.

Windows 8: Associate a file Type or protocol with a specific app using GPO (e.g:default mail client for MailTo protocol)

Windows 8: Associate a file Type or protocol with a specific app using GPO (e.g:default mail client for MailTo protocol)

  • Comments 37
  • Likes

For my first post I have chosen a topic  that I have seen lots of “buzz” out there but no clear information on how to implement it in win8
Its common knowledge that  You can associate a file type or protocol with a  specific program/app using the default programs < Control Panel\Programs\Default Programs>

 

However this is not practical  if you want to establish the same settings for several machines.

In  Pre-Win 8, apps could set the default handler for a file type/protocol by manipulating the registry, this means you could easily have a script or a group policy manipulating the registry.
For example  for Mailto protocol you just needed to change the “default” value under HKEY_CLASSES_ROOT\mailto\shell\open\command

However In Win 8, the registry changes are verified by a hash (unique per user and app)  that detects tampering by apps. In the absence of a valid hash, we ignore the default in the registry.
HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\URLAssociations\MAILTO\UserChoice

Solution:
Microsoft  have  introduced a new GP mechanism for declaring these defaults in Win 8 to accommodate this type of scenario. The basic idea is to have an xml file that maps programs to the file type/protocol that they should be the default for.
First you create your XML file or export it from a machine using DISM (http://technet.microsoft.com/en-us/library/hh825038.aspx):

Then you use the  new Windows 8  group policy that enables you to set the association for file types and protocols:
Computer configuration\administrative templates Windows Components\File Explorer\ Set a default associations configuration file
<HKLM\Software\Policies\Microsoft\Windows\System!DefaultAssociationsConfiguration>
This policy specifies the path for the XML  file that can be either stored locally or on a network location.

 
Note : using DISM to import the XML  is not enough you still have to link it to the GPO.

Note2:Bear in mind that the machine needs to be domain-joined and the associations are applied at logon time!

FAQ:
Q:I've tried this to set the mailto protocol association to outlook. But DISM doesn't show the value in the export. Anybody know a fix for that?
A:if the Program/Extension/Protocol is not present in the XML export, then you  need to first manual enable the association  Before running DISM. 

Q:Does this process work without having to re image a machine?
A: Yes.

 

 

 

Comments
  • Thank you very much!

  • Export dism command line does not work.

    ERROR: 87   -> Option "export-defaultappassocations" is unknown

    Any hints ?

  • I can't get this working. I ran a small test with the following xml on an online system, but later when I select a .bmp file, Win8 still wants to start the metro app instead of the desktop app. There seems to be more to it than this.

    dism /Online /Import-DefaultAppAssociations:Z:\$W8i\$W8-Deploy\test.xml

    <?xml version="1.0" encoding="UTF-8"?>

    <DefaultAssociations>

     <Association Identifier=".bmp" ProgId="Paint.Picture" ApplicationName="Windows Photo Viewer" />

    </DefaultAssociations>

  • BTW, I  enabled the appropriate  gpo entry and placed the test.xml in c:\windows\system32\

  • I have noted in several articles that this/these processes only apply when imaging machines. Does this process work without having to re image a machine? In some cases this cannot be done due to multiple machine types, so not practical. I need to be able to set these defaults for all users on EXISTING Windows 8 machines, not fresh clean images that haven't gone on a machine.

  • I've tried this to set the mailto protocol association to outlook. But DISM doesn't show the value in the export. Anybody know a fix for that?

  • Well isn't this SO MUCH MORE DIFFICULT!

    This is not a "new" feature, this is a headache! Where has the granular control of individual file associations gone? This is a blanket approach and has no flexibility. This is the current workaround for GPP not working anymore with Windows 8. Thanks for REMOVING functionality, MS.

  • Just Thank you! Thank you so much. This is a hard one until you find your informations...!

  • Just one thing to add: Be sure not to run the export with some "runas /user:domainadmin dism ..."-type of command because that would export the file-associations for your domainadmin instead of the user you just set them. Might be logical to most of you but could also help some people like me who do it wrong the first time. (Make you user admin for the export).

  • Has anyone managed to get this to work yet? I tried it and while I found that the DefaultAssociationsConfiguration registry key did get updated with the path to my XML file, it had no impact on what is showing in Default Programs on my test Windows 8.1 computer. (Oh, and the corresponding "policy mode" in the registry key did somehow get set to "2", which I understand translates to "replace".)  Was this whole process supposed to result in changes showing in Default Programs, or are the file associations from my XML file now set elsewhere in the registry, thereby overriding what shows in Default Programs?  What was supposed to have happened as a result of applying this group policy?  I put a lot of work into compiling a comprehensive XML file so that our users will have a smooth transition to Windows 8.1, and while this appears to be an efficient method of controlling file associations, personally I've found it to be a lot of work and very frustrating.

  • Doesn't appear to work with 8.1 :-(  Have you noticed the same?  

  • This does not work with Windows 8.1 - is there anyone that may confirm it works using another method? Many thanks.

  • It does work with Windows 8.1 Maybe you're doing something wrong?

  • Hi guys, Sorry for not answering before but I have been AFK for the last 6 months and will only be able to do any further tests in February.

  • It doesn't work With Win 8.1 (64 Bit). Assoc.xml - File looks fine, is stored locally, but Win still annoys with ignoring any changes. Even if the users choose file types manually, this isn't stored for the next session...

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment