Hi Guys,
I am writing a script that checks the value of a registry property. I first define a path to thelocation in the registry then try to get its value into a variable then test. Here's the snippet:
Powershell
$HKCU_myApp="HKCU:\Software\myApplication"$someArray# has list of installed applicationsIf($someArray-Match'App_123'){$pathToRegKey="$HKCU_myApp\App_123"# This is where it fails, if I replace $pathToRegKey with the literal path it works or if I replace $HKCU_myApp in the previous line, $pathToRegKey, with the literal path it works. I cannot concatenate $HKCU_myApp + $pathToRegKey$isLoggingEnabled=Get-ItemProperty$pathToRegKey-Name"DebugLog"Error:Get-ItemProperty:Cannotfindpath'HKCU:\Software\myApplication\App_123'becauseitdoesnotexist
Thanks