When creating Win32apps in Intune, we have a standard set of requirements we can use to determine if an app will install on a device or not. These are:
- Operating system architecture – mandatory rule
- Minimum operating system – mandatory rule
- Disk space required
- Physical memory required
- Minimum number of logical processors required
- Minimum CPU speed required
We can extend these requirements by creating our own custom requirements using file, registry or script.
I recently had to push out an application required an Outlook profile to exist on the device before execution. I can detect whether the profile exists on the device with a registry value, so I could have used the registry choice when creating this requirement. I decided, however, that I wanted to use a PowerShell script to achieve this.
The script itself is very simple, does the registry path exist, if so write the output, so that the custom requirement can use this:
if((Test-Path -LiteralPath "HKCU:\Software\Microsoft\Office\16.0\Outlook\Profiles\Outlook") -eq $true) {
Write-host "Outlook Profile"
}
When defining the app requirement click the +Add link in the Configure additional requirement rules section.

From the Requirement type drop down choose Script.

Click the folder icon next to the Script file field.

Locate your PowerShell script and click Open.

Note that this will populate the Script name field with the script name. Set another settings as required. Click the Select output data type drop down. This will be used to define what the requirement will capture from the PowerShell script.

There is a choice of data types to select from. I will select String for my data type.

Now I can define the Operator and Value fields. I want the value to equal the output from my PS script which is the write-host value of Outlook Profile. Click OK to save this info.

When the app is assigned, if the profile does not exist the application status will be listed as Not applicable, if the profile exists then the app will install (depending on any other requirements you state e.g. minimum OS).
Hope you find this useful.