none
Group Policy and xml files for configuring fileassociations in Windows 10

    Question

  • Thought i would share a funny solution to the edge stealing .pdf file Associations problem.

    So you need 2 different policies to do file Associations using Group policy for both Adobe Reader and Adobe Acrobat in Windows 10. Lucky you if you dont have this problem.

    But what if you run across another 2 Applications that share the same filetypes, and another pair. You need to enforce file Associations for. You would then need an exponential amount of policies for each new case of this you encounter.

    If you run into this problem or possibly already have there is a solution. You could put the defaultapps.xml file locally on Your machines and then use PowerShell to edit it or simply overwrite the file when it needs an update.

    Just make sure users on the machine cannot make changes to the file.

    Here is an example script that could be used:

    EditDefaultAppsXml.ps1 -DefaultAppFilePath C:\Data\Defaultapps.xml -Identifier ".pdf" -ProgId "NEWPROGID" -ApplicationName "NEWAPPLICATIONNAME"

    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$True)]
        [string]$DefaultAppFilePath,
    
        [Parameter(Mandatory=$True)]
        [string]$Identifier,
    
        [Parameter(Mandatory=$True)]
        [string]$ProgId,
    
        [Parameter(Mandatory=$True)]
        [string]$ApplicationName
    )
    $XMLFile = New-Object XML
    $XMLfile.load("$DefaultAppFilePath")
    $XMLFile.DefaultAssociations.Association
    "Setting application Name"
    ($XMLFile.DefaultAssociations.Association | where {$_.Identifier -eq "$Identifier"}).ApplicationName = "$ApplicationName"
    "Setting ProgId"
    ($XMLFile.DefaultAssociations.Association | where {$_.Identifier -eq "$Identifier"}).ProgId = "$ProgId"
    $XMLFile.DefaultAssociations.Association
    $XMLFile.OuterXML
    $XMLFile.Save("$DefaultAppFilePath")

    Friday, February 24, 2017 3:15 PM

All replies

  • Hi,

    Thanks for your good sharing.

    I am confused by this problem in a long time and now learn from you, that's my honor. I will also share the good solution to my customers who may encounter the such issue.

    Also, welcome you here in Windows 10 Forum.


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, February 27, 2017 2:26 AM
    Moderator