List all Intune plaform scripts containing a specific string
In this post I will share a script allowing you to search and list all plaform scripts containing a specific string.
Context
You have multiple Intune platform scripts.
You need to search for those one containing a specific string to identify them and do a change.
For instance, few weeks 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.
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 plaform scripts
- Check all scripts content
- Look for a specific string
- Export result
To run the script, use the below command:
.\PlatformScripts_SearchString.ps1
Three parameters are available:
- Pattern: the string to search in platform scripts
- GridView: export content in a gridview
- CSV: export content in a CSV
-All: show all scripts from Platform scripts (if not selected, only scripts with the specific string will be displayed)
In the below example I listed all scripts containing "webrequest".
See below the command to use:
.\PlatformScripts_SearchString.ps1 -Pattern "webrequest" -GridView
See below overview from gridview:
What about remediation scripts ?
You can find the same script for searching specific string in remediation scripts in this post.
.png)

Enregistrer un commentaire