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 } '