File type association is a process of attaching an extension (.txt) with a handler (notepad.exe). File Type Association in Citrix XenApp and XenDesktop is no different from windows operating system. In this article, we will see how to use Citrix WEM (Workspace Environment Manager) to configure per user FTA. I will also share some other methods like GPO, Logon Scripts, etc.
The easiest and hassle free method to configure FTA is through GPO. All you have to do is export FTAs using DISM (Deployment Image Servicing and Management) and push the Default Association Configuration File using a Group Policy Object.
Login to a Windows 10, 2012 R2 or 2016 server. Set the association of file types with desired applications either by going to Control Panel/Default Programs/Set your default programs/ or Control Panel/Default Programs/Associate a file type or protocol with a program/. Alternatively, you can right click on a file, click “Open with…” and then select the application.
On the other hand, right click on a file, select properties, click on change in General tab and then select the application.
Once you have completed file type association, open PowerShell as Administrator and execute following command:
PS C:\windows\system32> DISM.exe /Online /Export-DefaultAppAssociations:C:\AppAssoc.xml
This is how AppAssoc.xml looks like
File Type Association using GPO
Now edit a GPO and go to Computer configuration/Policies/Administrative templates/Windows Components/File Explorer. Open “Set a default associations configuration file” setting, click on enable, paste the path of AppAssoc.xml in “Default Association Configuration File”, click on Apply and then OK.
I prefer to keep AppAssoc.xml on some network share.
You may ask how Windows Operating system applies File Type Association when we have not configured any GPO or any other method. Well, at your first login, windows uses FTAs defined inside OEMDefaultAssociations.xml. The location of this file is C:\Windows\System32\.
Troubleshooting – Some users have reported that GPO wasn’t applying until they changed .xml to .txt. Check this out.
Note – Enforcing FTAs with the help of GPO does not restrict users from changing the association of a particular extension with a different application or handler. However, as we already know that GPO will override users’ FTAs on next either logon or refresh interval.
In Citrix XenDesktop or Citrix Virtual Desktop scenario, you can copy everything inside AppAssoc.xml and paste it in OEMDefaultAssociations.xml on the golden image. This way you don’t have to configure any GPO.
Per User File Type Association in Citrix XenApp and XenDesktop
Do you notice the problem with setting up the File Type Association through GPO? It is a computer-based setting, which means you cannot associate your users to the same Server/Desktop with different file types. For instance, you want few users to open PDF files in Soda PDF (for license purpose) and other users to open PDF files in Adobe reader.
Unfortunately, it is not possible anymore and Microsoft says, “This is by design for security measures”. In windows 7 and windows server 2008 R2, it was not an issue but Microsoft changed this behavior with the release of windows 8.1. The restriction also apply to Windows 10, Windows Server 2012 and 2016. This is what Microsoft states about it:
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. 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.
Fortunately, Christoph Kolbicz reverse engineered the Hash algorithm and created SetUserFTA.exe utility to make our life a lot easier. SetUserFTA generates the secret hash for a supplied extension. By the way, James Rankin has done a great job in explaining this Hash Value, the registry key it modifies and the permission changes on the UserChoice key. You should definitely read this article.
To download SetUserFTA, visit kolbi.cz and scroll down to Download section. There you can download the latest version. I am going to demonstrate the WEM method to configure File Type Association for a group of users as it is the most suitable and efficient way of doing this. For the Logon Script method, visit the page I linked above and scroll down to “How can I deploy this” section.
File Type Association using Citrix WEM
- Once downloaded, unzip SetUserFTA and save it on a file share.
- Login to WEM management console and create an external task as shown in below picture
- Assign this External Task to a user group.
SetUserFTA has multiple Syntax like:
SetUserFTA.exe extension progid SetUserFTA.exe extension progid groupname SetUserFTA.exe configfile SetUserFTA.exe del extension
What we are passing as argument in our External Task is the first one where extension is .pdf and progid is “Soda PDF Desktop 10”. The Path field is the path to SetUserFTA.exe on a file share. To understand other syntaxes, visit the same page I linked above.
To locate the ProgId, browse to HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts and open the key that corresponds to the FTA you have set (in this example, .pdf). Then open the UserChoice subkey. The ProgId value here is the one you want to populate in WEM