i’ve tryed to modify the default app for open the pdf file. i’ve tried with this command but it doesn’t function.
[scriptblock]$HKCURegistrySettings = {
# Set the Progid value to "AcroExch.Document.DC" to associate PDF files with Adobe Acrobat
Set-RegistryKey -Key "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\UserChoice" -Name "Progid" -Value "AcroExch.Document.DC" -SID $UserProfile.SID
}
Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings
I can see two issues potentially.
The Set-RegistryKey command may be wrong - Review this:
Unless it is a formatting issue on the code examples on the web page - It appears you do not require the : in the Key
Also you are missing a \ before .pdf (after \FileExts) in your command
Try this:
[scriptblock]$HKCURegistrySettings = {
# Set the Progid value to "AcroExch.Document.DC" to associate PDF files with Adobe Acrobat
Set-RegistryKey -Key "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\UserChoice" -Name "Progid" -Value "AcroExch.Document.DC" -SID $UserProfile.SID
}
Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings
Alas, the days of using the registry to set file associations are gone.
Microsoft put an end to it and now you have to fight Edge to stop showing PDF files.
you cannot set \Userchoice\ in HKCU easily.
There are many workarounds.
Home users need to learn how to manually set file associations.
In fact, I ran into a problem some time ago and remember that I eventually had to abandon the idea precisely because Microsoft did not allow the change. So in the end I had to insert a rule in the image deployment process before the user logged on to the PC.