you're reading...
PowerShell, SCCM, Windows

How to display a custom window in SCCM Task Sequence using PowerShell

If you have been working with SCCM deployments long enough, eventually you may encounter a need to display a window during running Task Sequence. It may be just a simple message box advising user to save all their data, up to more complex solutions with multiple options for the users. Whichever it might be, you first design and test your solution outside of Task Sequence and it works fine, then you try to run this inside of Task Sequence and… nothing happens.

This article will briefly guide you through how to show a custom message (topic covered widely on the net already), as well as how to ensure it doesn’t fail your Task Sequence in certain circumstances.

First of all, put together your PowerShell script with your custom window. As mentioned before, this can be a simple message box or a more complex solution, for example setting Task Sequence variables based on user’s choices – the sky is the limit. If you are planning a more complex solution, try building your own window using PowerShell and WPF – there is a brilliant tutorial on the topic that I can’t recommend enough: https://foxdeploy.com/2015/04/10/part-i-creating-powershell-guis-in-minutes-using-visual-studio-a-new-hope/


A sample WPF form displayed during Windows 10 upgrade Task Sequence.


Once you have your script at hand, grab your latest MDT source media and copy ServiceUI.exe from Toolkit\Tools\x86  subfolder (you can use x86 executable on both x86 and x64 platforms.) to folder with your script’s source files. Next, wrap it all up in a Package (do not create a Program).


Content of SCCM Package containing ServiceUI.exe.


Last thing you need to do, is to call your PowerShell script through ServiceUI using the following syntax:

ServiceUI.exe -process:TSProgressUI.exe %windir%\sysnative\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass -nologo -File Defer-Installation.ps1

PowerShell script called in a Task Sequence using ServiceUI.exe.


We are done, right? Not quite. This will work just fine, as long as there is a user logged on. This may not always be the case if you are deploying your Task Sequence as Required. When Task Sequence runs this step with no user is logged on, it will typically fail with the follow error:

Process completed with exit code 4294967295
Process Not Found: [TSProgressUI.exe]

Exiting with [-1]
Failed to run the action: Defer installation script *. Unknown error (Error: FFFFFFFF; Source: Unknown)

Task Sequence failure as observed when no user is logged on.


Now, you can easily avert this failure by applying a WMI query on the Task Sequence step. You will find that some suggest using the following query:

SELECT * FROM Win32_ComputerSystem WHERE Username IS NOT NULL

This query checks if a user is logged on, however it is only limited to the local console session. Any user logged on via RDP will not be registered in Win32_ComputerSystem class. This solution might be good enough for your scenario, but if you want to cater for RDP users, you should use slightly different query. The original error message told us what the underlying problem was – the TSProgressUI.exe was not running. This means the Task Sequence was running, but it hasn’t spawned the process responsible for showing the progress, as there was no users to create it for. Therefore, our query should check if TSProgressUI.exe exists.

SELECT * FROM Win32_Process WHERE Name = "tsprogressui.exe"


This will work for both users logged in locally, as well as those logged in via RDP.

Happy prompting!


9 thoughts on “How to display a custom window in SCCM Task Sequence using PowerShell

  1. Hi,

    Thanks for this Blog, very useful information. I work actually for in place upgrade Task sequence to migrate all computer to 1607 -> 1803. i create my own GUI with Xaml and powershell but i want to add new item to defer task sequence to end user but i have no idea how i can do that .. it’s more difficult .

    I see you have dit it in your HTA GUI .. So can you help me please? can you if its possible share you powershell code for this features ?

    Thanks in advance



    Posted by GERARD kevin | 2018-08-31, 12:44
  2. Hi
    Such a message box is just what I was looking for.
    Have you finished your coding or do you need a tester ?


    Posted by Rico Rosenheim | 2018-11-07, 14:41
  3. Hi Mietek,

    nice message box. I was looking all the time for such a cool thing.
    Can you share your .ps1-Code with us ?

    Thanks in advance



    Posted by Florian S. | 2019-01-22, 09:58
  4. please let me know if the coding finished .it will be great if you share the coding . thanks


    Posted by matchandmorejewelleries | 2019-08-05, 10:20
  5. hello, it’s possible to have the source code of this form to upgrade Windows 10 please.


    Posted by cedric | 2021-06-10, 09:02
  6. Excellent work on the Deferral UI, can the code be made available to public? Thannks.


    Posted by Xoudiz | 2023-03-07, 15:17

Leave a Reply to Florian S. Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: