[PS] Retrieve default PDF-reader registry value

Until now, i only knew one way of retrieving the default app-association for a specific file extension (.pdf, .xlsx, .docx) and that is by using DISM and exporting an .xml file. But this can only be done with an elevated prompt (as far as i know).

This is where my problem started, if you elevate an cmd prompt, you will only export the standard app-associations for that particular user (admin user). I wanted to display the standard app-associations for the user on that specific computer.

Long story short, i found the registry value where you can see this, it’s probably not a good idea to change this value here, for that you will have to use DISM i think, correct me if i’m wrong. If you want to retrieve the standard app-association for another file extension, just change .pdf to whatever you want to retrieve.

Registry path:


And what i uses this for is just running it on remote computers through a PS-session with this script:

Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$sid = ([System.DirectoryServices.AccountManagement.UserPrincipal]::Current).SID.Value
$path = "Registry::HKEY_USERS\$sid\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice"
(Get-ItemProperty -Path $path -Name ProgId).ProgId





Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.