I am using a powershell script to check for a registry key (infact I'm checking all the values within a key, and excluding the values that we know should be there. if there is anything less the IF check outputs a 1.) Now running this script works fine, if there are additional values we get a 1 output. If I a remove any additional values, leaving only the value we expect to see then the script doesn't return anything.
Looking at all the docs (https://tech.nicolonsky.ch/intune-win32-app-requirements-deep-dive/ for example) it looks like I'm doing this correct.
But running the app on devices, they are all coming back as installed when I know for a fact all the devices have no additional values. I've ran the PS script manually on the device, and as expected the script returns no output.
I'm missing something very obvious here I'm sure!
$dir = Get-Item HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\AutoDiscover
$accounts = ($dir | Select-Object Property -ExpandProperty Property)
if ($accounts2 = $accounts -notmatch "myorgname.co.uk"){
Write-Host $accounts2
Write-output 1
Exit 0
}
