Jean-Yves Moschetto's blog

Tip and tricks on Microsoft products

NAVIGATION - SEARCH

Being tired of Microsoft Edge to always try to open PDF file rather than Adobe Acrobat?

Symptoms

- First you are disappointed with Microsoft Edge trying to open PDF
- OK, that's probably a bug, don't care, I will change that
- OK, right click a PDF file, "Opens with", "Change" and select Adobe, that's it

Oh no, it should be to simple. Since you launch Edge, it takes precedence on Adobe ... ;-(

 

Right solution

- I've seen many people searching manually in the registry for Edge App, trying to do some thing, OK
- But bored to do that on each PC
- Bored to have to look for new AppX each time Microsoft Edge changed its version
- And so? OK, I love powershell, let's go

 

#Look for all Appx
$Appxs = Get-ChildItem 'HKCU:\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages' -Recurse
#Get only the ones which open PDF file
$PdfAppxs = $Appxs | Where-Object { $_.Property -eq '.PDF' }

#For each Appx able to open PDF, add 2 registry key to forcibly disable open PDF
foreach ($PdfAppx in $PdfAppxs)
{
	$PdfAppxId = $PdfAppx.GetValue('.pdf')
	$PdfAppxId
	New-ItemProperty -Path "HKCU:\SOFTWARE\Classes\$PdfAppxId" -Name 'NoOpenWith' -Value '' -PropertyType String -Force | Out-Null
	New-ItemProperty -Path "HKCU:\SOFTWARE\Classes\$PdfAppxId" -Name 'NoStaticDefaultVerb' -Value '' -PropertyType String -Force | Out-Null
	Remove-ItemProperty -Path "REGISTRY::$($PdfAppx.Name)" -Name ".pdf"
}


And of course, reset PDF to open with Adobe: right click a PDF file, "Opens with", "Change" and select Adobe
 
It was so simple in fact ;-)
If you work with SCCM, simply create a small package with that code and sequence that package to run just after each Windows X major update

Add comment