From f45d5d79a526dd2768d059b7ecd67253586d56ee Mon Sep 17 00:00:00 2001 From: rpaliwal Date: Thu, 6 Mar 2025 11:58:20 +0530 Subject: [PATCH] fix(script): Escape square brackets in registry key paths --- recipes/newrelic/infrastructure/windows.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/newrelic/infrastructure/windows.yml b/recipes/newrelic/infrastructure/windows.yml index 0ab9ed1a..16524b32 100644 --- a/recipes/newrelic/infrastructure/windows.yml +++ b/recipes/newrelic/infrastructure/windows.yml @@ -104,7 +104,8 @@ install: $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 @@ -131,8 +132,7 @@ install: } } 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 131; + throw $_.Exception } '