Skip to main content
Get Interactive: PSADT & ServiceUI
  1. Posts/

Get Interactive: PSADT & ServiceUI

Michael Escamilla
Author
Michael Escamilla
Table of Contents
PSADT and ServiceUI - This article is part of a series.
Part 1: This Article
Update July 10, 2025

PSADT version 4.1.x will NOT require the use of ServiceUI to run Interactive Mode.

PSADT 4.1 is out. Please go test and give the PSADT team any feedback: Releases · PSAppDeployToolkit/PSAppDeployToolkit

I also have another Blog about testing 4.1, check the Series link above ^

Having used PSADT for many different deployments in Configuration Manager, I love the features that allow you display prompts to users for different scenarios. But when making the move to Intune, you’ll soon notice that these prompts don’t appear.

I’m not going to pretend to know the exact underlying reason why it works in Configuration Manager and not Intune, but the gist is that Intune runs in the SYSTEM context, and it doesn’t have the necessary tools to have PSADT run in ‘Interactive’ mode.

This isn’t a new discovery, others have been dealing and working through this for a while. But I’ve recently seen some post asking about this, and I’ve also got a few questions about it from customers. So I figured why not do a quick write up so that I don’t have to keep googling it every time I get asked.

Additional Information
#

Starting Information
#

I plan to go over what you need to ‘Add’ to a PSADT package to get this working, but I won’t cover setting it up from scratch. Nor will I cover the creation of an IntuneWin file to be uploaded to Intune.

What you’ll need

  • A PSADT package already created
  • Know how to create Win32 apps in Intune
    • This mean generating an ‘IntuneWin’ file and uploading it to Intune
You will be running as SYSTEM

Be aware that you are running under the ‘SYSTEM’ context. Using ServiceUI just makes the PSADT and other installer windows appear for the current interactive user session. But the processes will have the power of ‘SYSTEM’, so be mindful of what interactions your are enabling for the user.

What is the actual problem?
#

Lets set a baseline of the issue and what it looks like.

I have a PSADT v4 package template for Notepad++ x64 version 8.8.1.

PSADTv4 Notepad++ package
PSADTv4 Notepad++ package
PSADTv4 Notepad++ package - Files Folder
PSADTv4 Notepad++ package - Files Folder

In the script I have the function to -CloseProcesses and -AllowDeferCloseProcesses to prompt the user to close the application if it’s currently running.

Show-ADTInstallationWelcome
Show-ADTInstallationWelcome parameters

I created a Win32app in Intune and set the installation command to the below:

Invoke-AppDeployToolkit.exe
Invoke-AppDeployToolkit.exe

I don’t specify any other parameters because the defaults are:

  • DeploymentType = ‘Install’
  • DeployMode = ‘Interactive’
Intune App - Program Properties
Intune App - Program Properties

When you run this app and view the PSADT log, we can see the issue:

PSADT No ServiceUI Demo Gif
PSADT No ServiceUI Demo

Even though the default DeployMode is Interactive, the log says the process is not running in user interactive mode, which sets the script to NonInteractive mode.
From there, the script forcefully closes the notepad++.exe process without prompting the user.

PSADT Log showing the DeployMode
PSADT Log showing the DeployMode

But what if you want to see the prompt to give your user the ability to defer the installation?

Get ServiceUI
#

First thing you need to do is get a copy of the ‘ServiceUI.exe’ from an installation of Microsoft Deployment Toolkit

MDT download page missing?

Microsoft Deployment Toolkit is no longer avaialble for download from Microsoft.

Hopefully you have a copy already, or you can get it from a trusted source.

Download the installer here: Microsoft Deployment Toolkit

Then run the install:

Navigate to the folder:

C:\Program Files\Microsoft Deployment Toolkit\Templates\Distribution\Tools

In the “Tools” folder are ‘x64’ and ‘x86’ subfolders. There are two architectures of ‘ServiceUI.exe’, an x64 and x86 version.
I typically use the x64 ServiceUI, but depending on what you are doing for your app installation, you may need to use a specific Architecture.

MDT Tools folder
MDT Installation directory - Tools

What I would recommend doing, is copying ServiceUI.exe from each architecture folder, and renaming it to ServiceUI_<Arch>.exe like below:

Copying ServiceUI.exe
Saving ServiceUI.exe with architecture suffix

Renaming the exe’s accordingly will make more sense later. But at a minimum, it just makes it easier to tell them apart, and also allows you to store in the same directory.

Add ServiceUI to a PSADT package
#

Now that you have the ServiceUI exe’s, copy them to the ‘root’ of your PSADT package like below:

ServiceUI in PSADT package
ServiceUI in PSADT package

From here, generate your ‘IntuneWin’ file, then create and upload it to Intune.

Intune: Install command
#

When creating the Win32app in Intune, use the below command for the ‘Install command’

.\ServiceUI_x64.exe -process:explorer.exe Invoke-AppDeployToolkit.exe
Intune App Install Command for ServiceUI
Intune App Install Command for ServiceUI

You can also use ServiceUI for the ‘Uninstall command’ as well:

.\ServiceUI_x64.exe -process:explorer.exe Invoke-AppDeployToolkit.exe Uninstall

Success, we are Interactive
#

If we run this application I’ve created ‘PSADT -Notepad++ - ServiceUI’ using the above install command, the PSADT prompts show!

PSADT with ServiceUI Demo Gif
PSADT with ServiceUI Demo

Looking at the PSADT log again, it reports that we are ‘in user interactive mode’, and instead of focefully closing the app, we were prompted to close:

PSADT Log showing the DeployMode with ServiceUI
PSADT Log showing the DeployMode with ServiceUI

Downsides? No user logged on?
#

Are there any downsides to use the above install command? ‘Yes’

When calling ServiceUI directly like we did above, it will only run the Invoke-AppDeployToolkit.exe if the explorer.exe process is running. This process only runs when a user is logged on.

If want to have your package run when no users are logged on, then unfortunately the above install command will not work.

Alternative command line using Invoke-ServiceUI.ps1
#

To address the above issue of not being able to run ServiceUI with no users logged on, the amazing PSADT team created a script.

Download the script here: PSAppDeployToolkit/examples/ServiceUI at main · PSAppDeployToolkit/PSAppDeployToolkit

The description from the README says it all:

This will launch the toolkit silently if the chosen process (explorer.exe by default) is not running. If it is running, then it will launch the toolkit interactively, and use ServiceUI to do so if the current process is non-interactive.

Awesome! The script will handle both scenarios for us and automatically run our PSADT package accordingly.

PSADT Package Setup
#

All you need to do is add the ‘Invoke-ServiceUI.ps1’ script to your package.

Remember how we named the ‘ServiceUI’ exe’s? Well this is why:

There are x86 and x64 builds of ServiceUI available in MDT under Microsoft Deployment Toolkit\Templates\Distribution\Tools. Rename these to ServiceUI_x86.exe and ServiceUI_x64.exe and place them with this script in the root of the toolkit next to Invoke-AppDeployToolkit.exe.

The script will automatically call the ServiceUI exe based on the machine’s architecture, as long as they named properly.

PSADT Package with ServiceUI and Invoke-ServiceUI.ps1
PSADT Package with ServiceUI and Invoke-ServiceUI.ps1

Install Command
#

When utilizing the Invoke-ServiceUI.ps1, use the below command for the Install command

%SystemRoot%\System32\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy Bypass -NoProfile -File Invoke-ServiceUI.ps1
PSADT Install Command using Invoke-ServiceUI.ps1
PSADT Install Command using Invoke-ServiceUI.ps1

And for the Uninstall command:

%SystemRoot%\System32\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy Bypass -NoProfile -File Invoke-ServiceUI.ps1 -DeploymentType Uninstall

Go get interactive!
#

Hopefully this information helps.

I’ve only had do this a few times, but each time I’ve had to google and search for the commands again. Not I’ve got them in a place I’ll remember.

Let me know if you have any feedback on this or if I missed any other use tips and tricks for utilizing ServiceUI with your PSADT package for Intune.

PSADT and ServiceUI - This article is part of a series.
Part 1: This Article