Reader small image

You're reading from  Microsoft Intune Cookbook

Product typeBook
Published inJan 2024
PublisherPackt
ISBN-139781805126546
Edition1st Edition
Right arrow
Author (1)
Andrew Taylor
Andrew Taylor
author image
Andrew Taylor

Andrew Taylor is an End-User Compute architect with 20 years IT experience across industries and a particular interest in Microsoft Cloud technologies, PowerShell and Microsoft Graph. Andrew graduated with a degree in Business Studies in 2004 from Lancaster University and since then has obtained numerous Microsoft certifications including Microsoft 365 Enterprise Administrator Expert, Azure Solutions Architect Expert and Cybersecurity Architect Expert amongst others. He currently working as an EUC Architect for an IT Company in the United Kingdom, planning and automating the products across the EUC space. Andrew lives on the coast in the North East of England with his wife and two daughters.
Read more about Andrew Taylor

Right arrow

Using custom detection scripts in apps

While we covered this briefly in Chapter 11, detection scripts work slightly differently from a PowerShell platform or remediation script, so this recipe will cover how they work and include some working examples.

How to do it…

The important thing to note with a custom detection script is it requires both an exit code (0) and a standard output (STDOUT). Sending an exit code of 1, or not including the STDOUT, will flag the installation as failed.

Before searching the STDOUT, the script must return an output. So, the following code will suffice and mark the installation as successful:

Write-output "App found"
Exit 0

Now, we can use and deploy a custom detection script:

  1. To use a custom detection script, you must add the script during packaging or after deploying. For post-deployment, click on Apps, then Windows. Find the application in question and click on it.
  2. Now, click on Properties and click Edit next...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Microsoft Intune Cookbook
Published in: Jan 2024Publisher: PacktISBN-13: 9781805126546

Author (1)

author image
Andrew Taylor

Andrew Taylor is an End-User Compute architect with 20 years IT experience across industries and a particular interest in Microsoft Cloud technologies, PowerShell and Microsoft Graph. Andrew graduated with a degree in Business Studies in 2004 from Lancaster University and since then has obtained numerous Microsoft certifications including Microsoft 365 Enterprise Administrator Expert, Azure Solutions Architect Expert and Cybersecurity Architect Expert amongst others. He currently working as an EUC Architect for an IT Company in the United Kingdom, planning and automating the products across the EUC space. Andrew lives on the coast in the North East of England with his wife and two daughters.
Read more about Andrew Taylor