PowerShell Set File/Protocol Type Association Default Application Windows 10/11
- Set File Type Association.
- Set Protocol Association.
- Get File Type Association.
- List File Type Association.
- Remove File Type Association.
- Get Protocol Type Association.
- List Protocol Type Association.
- Register Application.
- Unregister Application.
- Apply multiple file associations from a configuration file with optional group-based targeting.
Get-Help .\SFTA.ps1 -fullSet-FTA AcroExch.Document.DC .pdf
Set-FTA Applications\SumatraPDF.exe .pdf
Set-FTA AcroExch.Document.DC .pdf -AllowedGroup "Adobe Acrobat Users"
Set-FTAFromConfig \\mydomain.local\fileshare\SetUserFTAconfig.txt -LogFile SFTA.log -Silent
Config file lines use comma-separated values:
.pdf, AcroExch.Document.DC, GRP_Adobe_Reader
The third value (group) is optional. Lines starting with # or blank lines are ignored. Quote group names with spaces when calling Set-FTA directly; config files can omit the quotes.
Get-FTA -Extension .pdf -Detailed
Remove-FTA -Extension .pdf -ExtensionOnly
Set-PTA ChromeHTML http
Register-FTA "C:\SumatraPDF.exe" .pdf -Icon "shell32.dll,100"
- Windows KB5034765 introduced a UCPD.sys protection that blocks registry writes to
UserChoicekeys for some extensions and protocols. SFTA now writes those values through a dynamically named temporary copy ofpowershell.exeto ensure associations can be updated successfully. - If the temporary PowerShell helper cannot write the
UserChoice/UserChoiceLatestvalues, SFTA falls back to direct writes so association changes are applied instead of failing. The fallback now uses the registry API to create missing keys directly so the helper failure does not surface path or access errors. - If UserChoice keys carry deny ACLs that block writes for the current user, SFTA clears those deny entries before applying values so the association can be saved.
- When a ProgId has not previously been recorded for an extension, SFTA also seeds the corresponding
OpenWithProgidsentry so Windows does not prompt to pick an app even though theUserChoicehash is already present. - Windows Insider builds have begun migrating associations into
UserChoiceLatestwith a new machine-bound hash (AppDefaultHashRotation/AppDefaultHashRotationUpdateHashes). SFTA now writes that companion hash andProgIdbranch when a machine ID is available so new protections don’t ignore freshly-set defaults. - Pass
-SuppressNewAppAlertto disable the "new app installed" default-assignment prompts by setting theNoNewAppAlertpolicy flag for the current user (and HKLM when elevated) before writing associations. - Capture a run log via
-LogFile <path>; if you pass only a filename (no directory), the log is written to your%TEMP%directory. Combine this with-Silentto run unattended without console output while still writing a transcript. - After setting associations, SFTA now restarts
explorer.exeto immediately apply the new defaults in the shell and file picker dialogs. - Use
-AllowedGroup(or specify a group on each config line) to scope an association update to members of a specific local or domain group. Set-FTAFromConfigdefers theexplorer.exerestart until the end of the batch, only restarts when a mapping or missing hash is written, and skips entries that already point to the requested ProgId.
powershell -ExecutionPolicy Bypass -command "& { . .\SFTA.ps1; Set-FTA 'MSEdgePDF' '.pdf' }"
powershell -ExecutionPolicy Bypass -command "& { . .\SFTA.ps1; Set-FTA 'Applications\SumatraPDF.exe' '.pdf' }"
Set Sumatra PDF as Default .pdf reader from Windows Command Processor (cmd.exe) (Load Script From GitHub Raw URL):
powershell -ExecutionPolicy Bypass -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/DanysysTeam/PS-SFTA/master/SFTA.ps1'));Set-FTA 'Applications\SumatraPDF.exe' '.pdf' }"
See CHANGELOG.md
Usage is provided under the MIT License.
Copyright © 2022, Danysys. <danysys.com> Copyright © 2025, Computerservice ips