'SCCM HKCU Detection Issue
I am deploying a package install via SCCM however I have the detection method to run the following powershell script to detect a HKCU key for whoever is currently logged on. SCCM installs the app as 'SYSTEM' account and I have not chosen to 'install for user' as this prompts our users with a UAC dialog box which i am trying to avoid.
Even though it seems like the following code has worked, when i manually alter the registry key to something other than whats specified, Software Center still shows the app as 'installed' even though in theory it shouldnt as the key has been manually amended.
What am i doing wrong here?
$key = 'HKCU:\SOFTWARE\MCF\Kofax'
$valueName = 'Cert'
$valueData = '1.0'
if ((Get-ItemPropertyValue $key $valueName) -eq $valueData) {
"installed"
} else {
"NOT installed"
}
Solution 1:[1]
You can"t have an output if the software is NOT found. Every output in a detection via PowerShell counts as "Software detected".
Just delete "NOT Installed" from your script and it should work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | OneBavarian |
