Istanbul/Turkey

Show MessageBox During the Task Sequence

What I am doing in this post is a little bit modified version of the article below that was written by Niall Brady and all credits goes to its respective owner. Because in time, I might forget what I have modifed from the original article, I decided to post this here as a future reference.

https://www.windows-noob.com/forums/topic/14170-how-can-i-display-custom-messages-in-a-task-sequence-using-powershell-in-system-center-configuration-manager-current-branch/

 

 

1. Copy Powershell File and ServiceUI.exe to DisplayMsgBox Folder:

First create a folder named "DisplayMsgBox" under \\sccmsiteserver\Sources\MyScripts\

Copy ServiceUI.exe from MDT\MDTToolkit\Tools\x86 folder to DisplayMsgBox folder. (Even If Windows OS is x64, we use x86 version of ServiceUI.exe)

 

 Create a powershell file and name it as displayMsgBox.ps1, copy it to \\sccmsiteserver\Sources\MyScripts\DisplayMsgBox folder.

 Copy the below PS command into displayMsgBox.ps1 or Click to download this ps1 file

If you need to show your message as multiple lines you can put `n just before your messages.

 

[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [System.Windows.Forms.MessageBox]::Show("This is the first line of your msg. `nThis is the second line of the msg", "This is the Title of Msg Box", [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Warning)

Exit 0 

 

2. Create a Package

Now we will create a package without a program.

 

 

and complete the rest of the wizard and distribute the package to DPs.

 

 

3. Create the Task Sequence:

Now create a Custom Task Sequence without a boot image and edit it.

Click Add > New Group and named it Display Message

Click Add> General > Run Command Line

Give a name to this step

Add this command to command line box:

serviceui.exe -process:TsProgressUI.exe %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -NoProfile -ExecutionPolicy bypass -nologo -file displayMsgBox.ps1

 

Select package tick box and add DisplayMsgBox package to this step

 

 

Now it is ready, you can deploy the task sequence. In the Task Sequence screenshot above, you see some other steps, they are not important for the context of this post but let me explain what this TS does.

First user sees the message, message hangs until the user clicks OK button. 

Then It will uninstall a displaylink driver, reboots and installs the latest displaylink driver.

 

 

 

 

  • Hits: 3680