From e2e6d088ced2890506cd79f1829bfbb18ba5ec6a Mon Sep 17 00:00:00 2001 From: rpaliwal Date: Thu, 6 Mar 2025 12:38:07 +0530 Subject: [PATCH] fix(script): Escape square brackets in registry key paths --- scripts/install.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/install.ps1 b/scripts/install.ps1 index 1432b0156..22c22b3d8 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -37,10 +37,11 @@ try { | % { $_.Name.TrimStart("HKEY_LOCAL_MACHINE\") } $allKeys = $baseKeys + $wowKeys - + $uninstallIds = New-Object System.Collections.ArrayList foreach ($key in $allKeys) { - $keyData = Get-Item -Path HKLM:\$key + $escapedKey = $key -replace '\[', '`[' -replace '\]', '`]' + $keyData = Get-Item -Path "HKLM:\$escapedKey" $name = $keyData.GetValue("DisplayName") if ($name -and $name -match $Match) { $keyId = Split-Path $key -Leaf @@ -67,8 +68,7 @@ try { } } } catch { - Write-Host -ForegroundColor Red "We detected you may be running an anti-virus software preventing our installation to continue. Please check your anti-virus software to allow Powershell execution while running this installation." - exit 1; + throw $_.Exception } -msiexec.exe /qn /i $env:TEMP\NewRelicCLIInstaller.msi | Out-Null; +msiexec.exe /qn /i $env:TEMP\NewRelicCLIInstaller.msi | Out-Null; \ No newline at end of file