Loading...

Display toast notification with Header picture to user in System context with Intune or SCCM


In this post I will show you how to display toast notification with header picture for user in SYSTEM.

We will see how to use it through both Intune and SCCM.


Display simple notification

See my previous post about how to display simple toast notification (without header) for user in SYSTEM.


Context

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

You want to add a picture as header in your notification


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.

Indeed, if you run this kind of toast in system context or even in admin, you will get an Access Denied error.


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 with header in system context but for user we will use an awesome PowerShell module.

This one is called RunAsUser and has been created by Kelvin Tegelaar.

You can find the GitHub repo here.


The idea is really simple.

I run the main script in SYSTEM context.

This one will run the script containing the notification as a scriptblock using the cmdlet Invoke-AsCurrentUser


For now the solution is not really nice, but I will write a Function soon.


The notification

The toast notification I will display looks like as below:



I will write another post about how to use this kind of toast notification.

You can find another one nice post wrote by Ben Whitmore, here


How to use it ?

1. Add your header picture in your Notif folder

2. Edit the file Notif_Config.xml

3. Notif_Folder: Path that will contain notification files

4. Notif_Title: Title displayed in the notif

5. Notif_Text: Text displayed in the notif

6. Notif_Attribution: Text display at the bottom

7. Notif_Picture: Your header picture, like: logo_header.png


See below my XML example:



Get the script

You can download the script example by clicking on the below picture.



Implement in Intune

Create the folder content

1. Create a folder Display_Notif

2. Copy downloaded content in this folder


Create the package

1. Run IntuneWinAppUtil.exe

2. Select the folder Display_Notif

3. Select Display_Notif.ps1

4. Select an output folder

5. A package Display_Notif.intunewin will be created


Create the Win32 app

We will now integrate the intunewin package into Intune.

1. Go to the Microsoft Endpoint Manager portal

2. Go to Apps

3. Click on Add

4. Select Windows app (Win32) then Select

5. Click on Select app package file

6. Browse to Display_Notif.intunewin

7. Click on OK

8. Type a name and a publisher name and configure as you want

9. In Install and Uninstall command type the below one:

10. Click on Next

11. Choose your requirements

12. Click on Next

13. Choose your Detection rules

14. Click on Add

15. Click on OK 

16. Click on Next

17. In the Dependencies part click on Next

18. In the Scope tags part click on Next

19. In Assignments, go to Required and click on Add group

20. Select the group contaning device

21. The group will be added

22. Click on Next

23. Click on Create

24. Go to Device install status

25. Once it has been installed, status will be as below:


Implement in SCCM

Create the application

1. In your SCCM console, go to Software Library then Applications

2. Click on Create Application

3. Select Manually specify the application information

4. Type a name and choose what you want

5. Choose what you want, like an icon

6. Click on the Add button

7. Choose Script installer

8. Type a name

9. In the content location, browse to the folder path that contains the PS1

10. In the Installation program, select the PS1 file

11. Click on Add clause

12. Choose your Detection rules

16. Choose how you want to run the application

17. In the Requirements part click on Next

18. In the Software dependencies part, click on Next

19. Click on Next

20. Click on Close

21. Click on Next

22. Click on Next

23. Click on Close


Test through Software Center

1. Open the Software Center

2. The application appears in the Software Center

3. Click on Install

toast system 2012784966837029380

Publier un commentaire

1 commentaire

Ketan Kamble a dit…

Hi ,

Can you please us with the detection script.

I am unable to find the same in the GITHUB page.

Accueil item

Award

Mes articles en français

Author of Books

PowerShell GUI & WPF Group

PowerShell GUI & WPF Group

Join the FPSUGR

Join the FPSUGR

Stats