List all Intune remediation scripts containing a specific string in detection or remediation
In this post I will show you a script allowing you to search and list all remediation scripts containing a specific string.
Context
You have multiple Intune remediation scripts.
You need to search for those one containing a specific word, string to identify them and do a change.
For instance, few days ago, Microsoft did a change on cmdlet invoke-webrequest behavior.
If the UseBasicParsing parameter isn't added, the cmdlet may warn the user or the script may not continue.
I did a script to list Remediation scripts with Invoke-WebRequest and without UseBasicParsing parameter.
Now with this new script you can check for any string through a parameter -String.
Get the script
Click on the below GitHub picture to get the script
The solution
The script works as below:
- Authenticate to Intune
- Get all remediation scripts
- Check all detection/remediation
- Look for a specific string
- Export result
To run the script, use the below command:
.\IntuneRemediations_SearchString.ps1
Three parameters are available:
- Pattern: the string to search in remediation scripts
- GridView: export content in a gridview
- CSV: export content in a CSV
In the below example I listed all Remediation scripts containing "loganalytics".
See below the command to use:
.\IntuneRemediations_SearchString.ps1 -Pattern "loganalytics" -GridView
See below overview from gridview:
.png)

Enregistrer un commentaire