Loading...

Display simple toast notification for user in System context when running a Proactive Remediation script

Reply A+ A-


In this post I will show you how to display a simple toast notification when running a proactive remediation script in system context.


Context

- You want to check some parameters on device

- For this, you want to user Endpoint Analytics Proactive Remediation

- The remediation has to be executed in system context

- If something is wrong, you want to display a notification to the user


The issue

There is two cases.

Case 1: System context

The script is executed in system context.

The application is installed but notification is not displayed for user.

This is because we are running in system context.


Case 2: User context

The script is executed in user context.

The application will need admin rights to be installed.

The notification is displayed in for user.

This is because we are running in user  context.


The solution

In order to display a toast notification in system context but for user we will use a well known solution.

If you usually work with MECM, you know that a solution to display notification for user in system context is to use ServiceUI.exe from MDT.

You could imagine two solutions:

- Upload ServiceUI.exe to a blob storage

- Convert ServiceUI.exe to Base64


In my case I will use the second one.


How it works ? 

As mentioned before, I have converted ServiceUI.exe to Base64.

Then in the remediation script, I export the Base64 code to ServiceUI.exe

I also generate a PS1 script tu run the notification and run it from ServiceUI.exe


The script

Click on the below Github picture to get the script.



Proactive_Remediations 1882177706054135811

Enregistrer un commentaire

Accueil item

Award

Learn KQL in one month

Sponsors

You want to support me ?

Mes articles en français

Books in French


Stats