From 4ef7e3ace99ba03549296b64bf8bcfa32806d6cf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 1 Nov 2025 22:29:00 +0000 Subject: [PATCH 1/2] Initial plan From a1a5098ca28058d04aac149764d959c565deebe6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 1 Nov 2025 22:34:50 +0000 Subject: [PATCH 2/2] Add proper error handling for registry key creation Co-authored-by: ib-bsb-br <182176521+ib-bsb-br@users.noreply.github.com> --- "\"b/C:\\\\Windows\\\\SysWOW64\\\\pwsh.ps1\"" | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git "a/\"b/C:\\\\Windows\\\\SysWOW64\\\\pwsh.ps1\"" "b/\"b/C:\\\\Windows\\\\SysWOW64\\\\pwsh.ps1\"" index 1f5cdd2..a4144c2 100644 --- "a/\"b/C:\\\\Windows\\\\SysWOW64\\\\pwsh.ps1\"" +++ "b/\"b/C:\\\\Windows\\\\SysWOW64\\\\pwsh.ps1\"" @@ -496,8 +496,20 @@ $Steps = @( } ) -New-Item -Path $RegistryBase -Force | Out-Null -New-Item -Path $StepsKey -Force | Out-Null +try { + if (-not (Test-Path $RegistryBase)) { + New-Item -Path $RegistryBase -Force -ErrorAction Stop | Out-Null + } + if (-not (Test-Path $StepsKey)) { + New-Item -Path $StepsKey -Force -ErrorAction Stop | Out-Null + } + Write-Log "Registry keys initialized successfully." 'INFO' +} catch { + Write-Log "Failed to create registry keys in HKLM:\Software\PwshSetup: $($_.Exception.Message)" 'ERROR' + Write-Log "This may be due to insufficient permissions or WOW64 registry redirection." 'ERROR' + Write-Log "Please run as Administrator with elevated privileges, or check registry permissions." 'ERROR' + throw "Registry access denied. Exit:1" +} try { Invoke-Preflight