Create a Proactive remediations script package

In this simple example, we'll create a script package in Proactive remediations in the MEM portal which will report on whether a device is pending a restart from software updates.

Create the script package

In the MEM portal, navigate to Reports > Endpoint Analytics > Proactive remediations

Click Create script package and give it a name and description

Download the following script, then on the Settings page in the script package upload it as the Detection script file. There is no need to add a remediation script. Run the script in 64-bit PowerShell.

Have a read of the script so you understand how it works. You can use it as a starting point for your own scripts. The key things are that the inventoried data is outputted as key-value pairs in JSON format and that the output is not longer than the permitted length.

Add a scope tag if you need to.

On the Assignments page add an assignment and set the schedule.

Don't run the script more frequently than necessary. If the data you are inventorying doesn't change often, don't inventory it often. Also consider how often you will be exporting the data - if that's once per day, for example, a daily schedule on the PR should suffice.

Click Create.

View the output

Once some of your targeted devices have run the script, you can view the output in the MEM portal and verify that it's good.

In Proactive remediations, click on the script package you created and view the Device status report.

To view the output, click Columns and select at least the Pre-remediation detection output column.

In that column, click Review to see the output.

Note that the output is in JSON format - this makes it easy for the automation runbook to use the data.

Last updated