From 3991e7a6d032f0eb108fa2cd940487e366d3d1a0 Mon Sep 17 00:00:00 2001 From: X9 Dev Date: Thu, 16 Apr 2026 15:13:11 +0200 Subject: [PATCH] fix: mount HKCR PSDrive before PDF association writes HKCR: is not available by default in PS sessions - must be explicitly mounted via New-PSDrive before any registry operations on it. Co-Authored-By: Claude Sonnet 4.6 --- scripts/02-software.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/02-software.ps1 b/scripts/02-software.ps1 index 3385db3..a74af8b 100644 --- a/scripts/02-software.ps1 +++ b/scripts/02-software.ps1 @@ -142,6 +142,11 @@ if (Get-Feature $Config "software" "pdfDefault") { } else { Write-Log " Found: $acroExe" -Level INFO + # Mount HKCR PSDrive - not available by default in PS sessions + if (-not (Get-PSDrive -Name HKCR -ErrorAction SilentlyContinue)) { + New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null + } + # Set file type association via HKCR (system-wide, requires admin) $progId = "AcroExch.Document.DC" $openCmd = "`"$acroExe`" `"%1`""