Configuration item and Confguration baseline .. in InTune
- Jan 17, 2022
- Publish the app to all machines
- Use a detection script in the with something like this:if ((Get-ItemProperty -Path HKLM:\SOFTWARE\Company\App).Version -eq '1.2') { if (test-path -Path 'C:\Program Files\Company\App\app.exe') { write-host Company App key found with version 1.2 and software is installed exit 0 } else { write-host Company app key found with version 1.2 but software is not installed exit 1 } } if (-not (Get-ItemProperty -Path HKLM:\SOFTWARE\Company\App).Version -eq '1.2') { write-host Company App key not found so no need to install software exit 0 }
So.. If the specific key exists, the one that you want to detect if installation of the software is needed, then it will check for the software by checking the path in c:\program files. If it's not there, it will report it and exit with exit code 1. That way it will know it will have to install the software.
If the specific key doesn't exist on the system, it will exit with exit code 0 telling Intune that the software is installed (Not needed actually, but you know what I mean 😉 )
And like Rudy Ooms said, if the specific key is not there.. You can also create it, I read it like you already had that key present to specify a certain type of machine