There are still many applications that cannot be installed via MSI or a simple installation routine. This is where the win32 app comes into play in Intune (Microsoft Endpoint Manager). In Intune, this allows us to deal with routines and processes in a script and then check the installation with another script (custom detection script) or predefined detection rules (MSI, EXE, file or registry key).

In the past few years, I have accumulated a few different variations of detection scripts, which I am trying to collect here.

Use the button above to find my current collection of custom detection scripts for Intune win32 apps. It is important that you only use one of the blocks for your detection rule. If you want to know how a win32 app is structured in general and how I handle it, you can find it here (my take on win32 apps - Intune) one of my past blog posts.

You can currently find the following detection rules in my GitHub repository:

  • Detection of an EXE or a file
  • Validation file with specific content (e.g. versioning)
  • Existing EXE with exact target version
    • or higher version
    • and additional registry key
  • Registry key comparison
  • Detection of a scheduled task
  • Detection of a scheduled task including version

Explanation / example EXE with exact version

The recognition rules are all structured in such a way that the criteria are defined first:

$ProgramPath = "C:\Program Files\XXXXX\XXXXXX.exe"
$ProgramVersion_target = '1.0.2' 
$ProgramVersion_current = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($ProgramPath).FileVersionCode language: PowerShell (powershell)

The definitions are then compared or checked and if they apply, "Found it!" issued. This signals Intune that the package is installed successfully. Alternatively, you can end the script with 'exit 0'.

if($ProgramVersion_current -eq $ProgramVersion_target){
    Write-Host "Found it!"
}Code language: PowerShell (powershell)

Do you have any other custom detection scripts in Intune that help you in your everyday life or which you are up against?
Let me know in the comments. I would like to add them to my collection.