Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions "b/C:\\Windows\\SysWOW64\\pwsh.ps1"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down