When you install applications on your computer, the process automatically sets up the file association to their known file types and extensions. For example, installing Microsoft Office would associate .docx* or .doc* files with Microsoft Word and .xlsx* or .xlsm* with Microsoft Excel.
You wouldn’t need to manually set default file associations for well-known applications in those situations. But then, there’s always some exception. Some file extensions are not well-known and aren’t automatically associated with a program or application.
Suppose your users have files with non-popular extensions, such as *.txn and *.arg. When the user tries to open these files, they’ll be greeted with a prompt to choose an app to open these files, and this situation leads to confusion, a bad user experience, and calls to the service desk.
But don’t worry. You can change the file associations by deploying a group policy to control it. This way, you can consistently apply set default file associations to Active Directory user accounts.
Note. Learn how to deploy printers to users via Group Policy.
Table of Contents
Set Default File Associations Using GPO
Now that we’ve piqued your interest, let’s get down to how you can set default file associations using GPO.
- Log in to your domain controller and run gpmc.msc to open the Group Policy Management console.
- Navigate to Forest → Domains → your domain.
- Locate the container where you want to deploy the GPO. In this example, I’ll deploy the GPO to USA → California → Users.
- Right-click on the container and click “Create a GPO in this domain, and Link it here…”
- In the New GPO pop-up, type the new GPO name and click OK. Make the GPO name as descriptive as possible for quick identification.
- Right-click the new GPO and click Edit to launch the Group Policy Management Editor.
- Navigate to User Configuration → Preferences → Control Panel Settings.
- Right-click on Folder Options, click New → Open With.
- The “New Open With Properties” window opens.
Action: The valid actions follow the CRUD logic.
1) Create — If the file association setting does not exist, create it. If it already exists, do nothing.
2) Replace — If the file association setting does not exist, create it. If it already exists, delete it and then replace it with the new setting (or the same).
3) Update — If the file association setting does not exist, create it. If it already exists, update it. Unlike the Replace action, this only updates (overwrites) the existing setting without deleting it first.
4) Delete — If the file association setting exists, delete it. If not, then do nothing.
In our scenario, the appropriate action is to Update.
File Extension: Enter the file extension you want to associate. I’m creating an association for files with the “arg” extension in this example.
Associated Program: Enter the program executable or full path. For example, I’m associating “arg” files with notepad.exe.
Note. Not all programs are present in the system path, so be careful when entering the executable name only. To be safe, you can enter the static path of the program (C:.exe) or its variable path (%SystemRoot%.exe).
Check the “Set as default” box and click OK. - Repeat the previous step to add more default file associations.
- Ultimately, you’ll have created the GPO to set default file associations, similar to the screenshot below.
You can now close the Group Policy Management Editor.
Note. Check our fix for The Processing of Group Policy Failed error.
Confirm the GPO Deployment
We’ve created and applied the GPO to the California → Users container. The next step is to confirm whether the GPO was deployed and the intended result was applied—to set default file associations using group policy.
Force Group Policy Objects Update
The GPO update happens every 90 minutes by default. But during testing, it would make sense to force the update so you can quickly confirm the results.
Now pick a user account in the container where you applied the GPO.
In this example, I picked Daniel Taylor’s user account for testing.
Once logged in, run the following command in PowerShell.
gpupdate /force
You will see a similar result to the screenshot below. This one says that the “User Policy update has been completed successfully.”, which is our desired outcome.
Get the Applied Group Policy Objects using GPRESULT
Now, let’s confirm which group policy objects are applied to the account by generating a resultant set of policy (RSoP) summary.
On the command prompt or PowerShell, run the following command.
gpresult /R
Wait for the command to finish generating the report and locate the “USER SETTINGS” section. You can see under the “Applied Group Policy Objects” that the policy you created is listed.
This result confirms that setting default file associations using group policy has been deployed.
Check the Default File Association in the Registry
As a result of setting default file associations using group policy, the shell handling of the “.arg” and “.txn” file extensions was created in the registry. These registry entries are under “HKCU:\Software\Classes\extension_auto_file\shell\Open\command”.
For example, the entry for the “arg” default file association in the registry is:
HKCU:\Software\Classes\arg_auto_file\shell\Open\command
While this one is for the “txn” files.
HKCU:\Software\Classes\txn_auto_file\shell\Open\command
You can check these values manually in the registry editor (Regedit.exe) or in PowerShell, which is quicker. One of the commands to accomplish this is the Get-ItemPropertyValue cmdlet.
Get-ItemPropertyValue -Path HKCU:\Software\Classes\arg_auto_file\shell\Open\command\ -Name '(default)'
Get-ItemPropertyValue -Path HKCU:\Software\Classes\txn_auto_file\shell\Open\command\ -Name '(default)'
Suppose there are multiple extensions to check for the default file associations; you could apply your favorite iteration, like ForEach-Object.
$fileExt = @('arg','txn')
$fileExt | ForEach-Object {
"$_ = $(Get-ItemPropertyValue -Path HKCU:\Software\Classes\$($_)_auto_file\shell\Open\command\ -Name '(default)')"
}
Open the File
The ultimate test is to open the files without getting prompted about which app to use. As shown below, the two sample files (dummy.arg and dummy.txn) icons have been updated to match the associated application.
When you double-click on the file, it should open in the default app without any prompts.
Setting default file associations using group policy resets prevents users from making permanent changes to file type handling since the file association resets in every policy update cycle.
Conclusion
Setting default file associations using Group Policy provides an efficient way to manage file types across a network. By leveraging this feature, administrators can ensure that users have consistent and standardized experiences when working with files, improving productivity and reducing confusion.
However, it is essential to exercise caution when making changes to default file associations, as they can impact user workflows and require thorough testing before implementation. Communication and training are crucial to ensuring users are aware of any changes and understand how to navigate the new file associations.
1 comment
How did you get this working? This method is well documented to be broken since Win8.1