In Windows 10 build 1703 (as well as some previous builds), the full upgrade or Windows Servicing upgrade, the Edge browser breaks the PDF file association (meaning, you are forced to use Edge by default), and there is no automated method to fix it for current users. Microsoft uses the UserChoice reg to provide a unique hash for each file association in the user’s profile. While this offers a more secure method for handling file associations, it also presents several problems when trying to automate changing the app associated with each file extension. This is the research I have done, along with developing a couple solutions myself.
About UserChoice
The UserChoice registry key is used to associate file extensions with specific applications chosen by the user.
This key is located under the following registry path:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\
Within the FileExts key, there are subkeys for each file extension associated with the user’s choice. For example, if the user has chosen to open .txt files with Notepad, there will be a subkey named “.txt” under FileExts.
Under each file extension subkey, there is a subkey named “UserChoice.” This UserChoice subkey contains information about the user’s preferred application for opening files with that specific extension. This information typically includes the ProgId (Program Identifier) of the chosen application.
Here is a basic breakdown of the structure: HKEY_CURRENT_USER
HKEY_CURRENT_USER
│
└── Software
│
└── Microsoft
│
└── Windows
│
└── CurrentVersion
│
└── Explorer
│
└── FileExts
│
└── .ext (File extension, e.g., .txt)
│
└── UserChoice
│
└── ProgId (Identifier for the chosen application)
The ProgId value under the UserChoice subkey represents the Program Identifier associated with the chosen application. This ProgId is typically used by Windows to locate the appropriate application when opening files with the associated extension.
It’s important to note that the UserChoice settings are specific to each user profile on a Windows system. Each user can have their own set of file associations configured through the UserChoice registry key.
The purpose of UserChoice is to provide users with control over which applications are used to open specific file types, allowing them to customize their file associations based on personal preferences and workflow requirements. This feature enhances usability and flexibility within the Windows operating system.
On to some of the solutions…
Adobe’s Solution (not great)
https://helpx.adobe.com/acrobat/kb/not-default-pdf-owner-windows10.html
GP Method
If you can use GP, I recommend using it—either local or domain.
Start by setting the default PDF app(s) and then exporting the defaultassociations.xml file
Dism /Online /Export-DefaultAppAssociations:c:\defaultassociations.xml
Defaultassociations.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<DefaultAssociations>
<Association Identifier=”.acrobatsecuritysettings” ProgId=”AcroExch.acrobatsecuritysettings” ApplicationName=”Adobe Reader” />
<Association Identifier=”.fdf” ProgId=”AcroExch.FDFDoc” ApplicationName=”Adobe Reader” />
<Association Identifier=”.htm” ProgId=”IE.AssocFile.HTM” ApplicationName=”Internet Explorer” />
<Association Identifier=”.html” ProgId=”IE.AssocFile.HTM” ApplicationName=”Internet Explorer” />
<Association Identifier=”.mht” ProgId=”IE.AssocFile.MHT” ApplicationName=”Internet Explorer” />
<Association Identifier=”.mhtml” ProgId=”IE.AssocFile.MHT” ApplicationName=”Internet Explorer” />
<Association Identifier=”.partial” ProgId=”IE.AssocFile.PARTIAL” ApplicationName=”Internet Explorer” />
<Association Identifier=”.pdf” ProgId=”AcroExch.Document.11″ ApplicationName=”Adobe Reader” />
<Association Identifier=”.pdfxml” ProgId=”AcroExch.pdfxml” ApplicationName=”Adobe Reader” />
<Association Identifier=”.pdx” ProgId=”PDXFileType” ApplicationName=”Adobe Reader” />
<Association Identifier=”.svg” ProgId=”IE.AssocFile.SVG” ApplicationName=”Internet Explorer” />
<Association Identifier=”.url” ProgId=”IE.AssocFile.URL” ApplicationName=”Internet Browser” />
<Association Identifier=”.website” ProgId=”IE.AssocFile.WEBSITE” ApplicationName=”Internet Explorer” />
<Association Identifier=”.xdp” ProgId=”AcroExch.XDPDoc” ApplicationName=”Adobe Reader” />
<Association Identifier=”.xfdf” ProgId=”AcroExch.XFDFDoc” ApplicationName=”Adobe Reader” />
<Association Identifier=”.xht” ProgId=”IE.AssocFile.XHT” ApplicationName=”Internet Explorer” />
<Association Identifier=”.xhtml” ProgId=”IE.AssocFile.XHT” ApplicationName=”Internet Explorer” />
<Association Identifier=”acrobat” ProgId=”acrobat” ApplicationName=”Adobe Reader” />
<Association Identifier=”ftp” ProgId=”IE.FTP” ApplicationName=”Internet Explorer” />
<Association Identifier=”http” ProgId=”IE.HTTP” ApplicationName=”Internet Explorer” />
<Association Identifier=”https” ProgId=”IE.HTTPS” ApplicationName=”Internet Explorer” />
<Association Identifier=”mk” ProgId=”IE.HTTP” ApplicationName=”Internet Explorer” />
<Association Identifier=”res” ProgId=”IE.HTTP” ApplicationName=”Internet Explorer” />
</DefaultAssociations>
You can apply the GP via a reg key
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System]
“DefaultAssociationsConfiguration”=”c:\\defaultassociations.xml”
This could also be handled in an offline manner
Dism /Mount-Image /ImageFile:C:\mount\images\install.wim /Name:”Windows” /MountDir:C:\mount\offline
Dism.exe /Image:C:\mount\offline /Import-DefaultAppAssociations:c:\defaultassociations.xml
This, if you change your mind and would like to remove…
Dism.exe /Image:C:\mount\offline /Remove-DefaultAppAssociations
Notes
Don’t forget about ‘New Users’ or the default user profile
copy /y defaultassociations.xml \\%computername%\c$
reg add “HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System” /v DefaultAssociationsConfiguration /t REG_SZ /d “c:\defaultassociations.xml”
:: ADOBE ACROBAT READER 11
if exist “c:\Program Files (x86)\Adobe\Reader 11.0\Reader\” (
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\AcroRd32.exe\shell\open\command /ve /d “\”C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe\” \”%%1\”” /f >nul
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AcroRd32.pdf\shell\open\command /ve /d “\”C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe\” \”%%1\”” /f >nul
reg add HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications /d “AcroRd32″=”Software\AcroRd32\Capabilities” /f >nul
reg add HKEY_LOCAL_MACHINE\SOFTWARE\AcroRd32\Capabilities /v “ApplicationDescription” /d “AcroRd32 reads PDF files.” /f >nul
reg add HKEY_LOCAL_MACHINE\SOFTWARE\AcroRd32\Capabilities /v “ApplicationName” /d “AcroRd32” /f >nul
reg add HKEY_LOCAL_MACHINE\SOFTWARE\AcroRd32\Capabilities\FileAssociations /v “.pdf” /d “AcroRd32.pdf” /f >nul
reg add “HKEY_CURRENT_USER\SOFTWARE\Adobe\CommonFiles\Usage\Reader 11” /v OptIn /t REG_DWORD /d 0 /f
)
PAUSE
Filetype handler enforcement via a GPO policy
To set Acrobat Reader or Acrobat as default PDF file type handler:
-
Download the sample file association files. These files include all the file types supported by Acrobat and Reader with their DC. To create your own XML files:
- Run an elevated command prompt on a machine that has your default application set correctly.
- Type Dism /Online /Export-DefaultAppAssociations:<XML path>\AppAssoc.xml. This creates an XML file that has all your file types and their current associations.
- Edit the XML file to include only the file associations that you wish to enforce.
You can create different files for different groups in your organization. For example, you can have one group that has Adobe Reader set as default and another that uses Adobe Acrobat.
-
Place this XML on a shared network location or push this XML to all your machine-specific locations via a script. For example, C:\Windows\System32 (do not use a user-specific location).
-
Set the XML configured with your preferences in a Windows 8 Group Policy setting, and enable the setting as follows:
- Open up the Group Policy MMC (open a command prompt and type gpedit.msc) on your Server instance.
- Locate the policy under Computer Configuration\Administrative Templates\Windows Components\File Explorer\Set a default associations configuration file. This policy specifies the path for the XML file that can be either stored locally or on a network location.
- Enable the policy, and specify the location where you have stored the XML file. The corresponding registry entry is HKLM\Software\Policies\Microsoft\Windows\System\DefaultAssociationsConfiguration.
Prevent Edge from hijacking file associations
GPO – User Preferences
DisallowDefaultBrowserPrompt
HKCU\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Main
REG_DWORD
DisallowDefaultBrowserPrompt = 1
NoStaticDefaultVerb
HKCU\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
REG_SZ
NoStaticDefaultVerb = (Blank)
NoOpenWith
HKCU\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
REG_SZ
NoOpenWith = (Blank)
NoOpenWith
HKCU\Software\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9
REG_SZ
NoOpenWith = (Blank)
Reg Keys (apply during login)
REG ADD “HKEY_CURRENT_USER\Software\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9” /v NoStaticDefaultVerb /t REG_SZ /f
REG ADD “HKEY_CURRENT_USER\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723” /v NoStaticDefaultVerb /t REG_SZ /f
REG ADD “HKEY_CURRENT_USER\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723” /v NoOpenWith /t REG_SZ /f
REG ADD “HKEY_CURRENT_USER\Software\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9” /v NoOpenWith /t REG_SZ /f
Other
Windows Registry Editor Version 5.00
[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf]
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf]
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\OpenWithList]
“a”=”Acrobat.exe”
“MRUList”=”a”
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\OpenWithProgids]
“Acrobat.Document.2015″=hex(0):
UserChoice Engineering Details
The contents of the UserChoice subkey dictate the default application for opening the file type:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts
Microsoft fails to detect the user’s original PDF reader (intentionally, I’m guessing), thus preventing the generation of a new UserChoice hash. If the hash is not correct, Edge becomes the default reader. This is why the Edge browser is becoming the default PDF reader—MS just didn’t put the correct logic in to detect every possible version of Reader, Pro, Standard.
SUPER SECRET USERCHOICE HASH
extension = “.pdf”
SID = “S-1-5-21-5237425623-0426251624-7215293041-1001”
UserProgID = “AcroReader.DC”
RegDate = “01d2449a35746500”
Experience = “Secret String”
PROGRAMMING LOGIC
#1 Return timestamp of UserChoice reg key (yes, reg keys have timestamps):
HKEY_USERS\S-1-5-21-5237425623-0426251624-7215293041-1001\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\UserChoice
#2 Fill Buffer with Values:
extension, SID, ProgId, timestamp, static string
#3 Hash and Encode Buffer:
Base64(MicrosoftHash(MD5(toLower(Extension, SID, ProgId, RegDate, Experience))))
Bask in the glory of success…
tags: Microsoft User Choice hashes, MrNetTek