Display simple toast notification for user in System context with Intune

4 A+ A-

In this post I will show you how to display toast notification on devices in system context using Intune. We will see how to display simple toast with text, toast with logo then header picture.

You want to install an application on a devices
You want to display a toast notification on device after install
You want that this notification is displayed on the user session

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.
We will then use ServiceUI.exe with our PS1 in a Win32 package.

Get the script

The notif
In the GitHub download link you can find the script samples:
- System_Notif_Sample: Notif with just title and message

See below an overview of the notification.

Implement in Intune
Create the folder content
1. Create a folder Show_Notification
2. Get the ServiceUI.exe
3. Copy the ServiceUI.exe 
4. Copy the file System_Notif_Sample.ps1

Create the package
1. Run IntuneWinAppUtil.exe
2. Select the folder Show_Notification
3. Select System_Notif_Sample.ps1
4. Select an output folder
5. A package System_Notif_Sample.intunewin will be created

Create the Win32 app
We will now integrate the intunewin package into Intune.
1. Go to Intune
2. Go to Client apps
3. Go to Apps
4. Click on Add
5. Select Windows app (Win32) then Select
6. Click on Select app package file
7. Browse to System_Notif_Sample.intunewin
8. Click on OK
9. Type a name and a publisher name and configure as you want
10. In Install and Uninstall command type the below one:
11. Click on Next
12. Choose your requirements
13. Click on Next
14. In Detection rules, select Use a detection script
15. Browse the script Detection_scripts.ps1
16. Click on Add
17. Click on OK 
18. Click on Next
19. In the Dependencies part click on Next
20. In the Scope tags part click on Next
21. In Assignments, go to Required and click on Add group
22. Select the group contaning device
23. The group will be added
24. Click on Next
25. Click on Create
26. Go to Device install status
27. Once it has been installed, status will be as below:
toast notification 2529773528561841324

Enregistrer un commentaire

4 commentaires

Benoit a dit…

Thanks but where is Detection_scripts.ps1 or how to build it ?

Damien Van Robaeys a dit…

Oops, you're right.
I will add it.
In my case I just created a txt script in the notif, my detection script will be to check if this file exists

Unknown a dit…

This is not working

Anonyme a dit…

Please can you assist?

I have copied and pasted the ServiceUI.exe and .ps1 file into the Show_notification folder.

I then used the Intune Utility tool to wrap whatever is within this folder (Service UI and .PS1)

I need to understand what you used as the detection script and how it all comes together? the banner doesn't seem to be showing up in the corner.

Accueil item



Learn KQL in one month

You want to support me ?

Mes articles en français

Books in French