Interactive Uninstall runs Silently

Hoping somebody can help me with this as it feels like I’m going in circles!
I installed an app using PSADT via SCCM a couple of years back and now I need to uninstall it to make room for a new version. Normally I remove the asset from SCCM which triggers the uninstall however with this app I’ve found out that only 20 of the 300 installs actually have the SCCM installer in the cache. So I’ve written a PowerShell script to copy the PSADT installer over to the Win 10 laptops and then run the Uninstall command. Problem is, I need it to be an interactive uninstall as the user needs to close various apps first but the script is just running silently and closing all the apps and running the uninstall

If I remote on and run Uninstall.bat or
Deploy-Application.exe -DeploymentType “UnInstall” -DeployMode “Interactive” or
powershell.exe -Command “& { & ‘.\Deploy-Application.ps1’ -DeploymentType ‘Uninstall’ DeployMode “Interactive” }”
The script runs as intended and the user get the GUI and a controlled restart.

If I run any of the commands via a PowerShell script running from SCCM, then the uninstall runs brutally but silently.

When I run the PS from SCCM *running as System), the log shows

Session 0 detected, process not running in user interactive mode; deployment mode set to [NonInteractive].]LOG]!><time=“11:59:21.54760” date=“04-04-2024” component=“PSAppDeployToolkit” context=“NT AUTHORITY\SYSTEM” type=“1” thread=“40540” file=“AppDeployToolkitMain.ps1”>

<![LOG[[Initialization] :: Installation is running in [NonInteractive] mode.]LOG]!><time=“11:59:21.56260” date=“04-04-2024” component=“PSAppDeployToolkit” context=“NT AUTHORITY\SYSTEM” type=“1” thread=“40540” file=“AppDeployToolkitMain.ps1”>

when I run the Uninstall\scripts (as admin for CMD or PS) directly the log shows

<![LOG[[Initialization] :: Session 0 not detected.]LOG]!><time=“15:26:30.05360” date=“04-04-2024” component=“PSAppDeployToolkit” context=“org\kh” type=“1” thread=“42772” file=“AppDeployToolkitMain.ps1”>

<![LOG[[Initialization] :: Installation is running in [Interactive] mode.]LOG]!><time=“15:26:30.05960” date=“04-04-2024” component=“PSAppDeployToolkit” context=“org\kh” type=“1” thread=“42772” file=“AppDeployToolkitMain.ps1”>

As the installer is 2 years old, I updated the PSADT files on the installer but same issue.

I have over a dozen PSADT scripts but this is the only one that uses interactive GUI but the original SCCM installer still works so I’m stumped as to what setting I need to change so that Session 0 can trigger the interactive GUI for the uninstall.

Any help appreciated and sorry for the waffle!

there is a bug you might be interested in following PSADT Runs Silent if Windows Security Service is disabled · Issue #941 · PSAppDeployToolkit/PSAppDeployToolkit · GitHub

Hi
Thanks for that but I had already seen that article and tried the suggestion. However it doesn’t resolve the issue and like I said, the script runs as expected when deployed via SCCM package. It’s only when I try to run the uninstall command from within an PS script run from SCCM that I get the silent uninstall.

Thanks

Unless I’m confused, this sounds like it may be a requirement for the MDT (Microsoft Deployment Tollkit) ServiceUI.exe as this will allow you to bring any messaging displayed in the SYSTEM context through to the users session.
Although I’m not an SCCM user, I know from another article here (sorry I can’t find it right now) SCCM already has this functionality built in via a check box setting, but via Intune (which we use) we normally deploy SYSTEM deployed apps along with the ServiceUI.EXE.
So if in your case you were using Intune and you used ServiceUI.exe the uninstall command line would be:

ServiceUI.exe -Process:explorer.exe Deploy-Application.exe -DeploymentType "Uninstall"  -DeployMode “Interactive”

Maybe this will help you?

ServiceUI is only needed with Intune, as SCCM has a native checkbox to make the installer process visible to the user. So make sure that box is checked!

2 Likes

DanGough is correct on the Allow the User to Interact box, also make sure your PSADT command for the package is not using the silent switch. I am newish to PSADT but recently I crafted a script to update Cisco VPN. I planned on using the message boxes to notify the client of update, allow them to defer, etc. In phase 2 testing I added the silent switch which I was not aware would silence everything including the notification screens. Live and learn

Thanks for the replies and apologies for not replying sooner.
The original PSADT deployment was done back in 2022 and I did not have to enable interaction within the SCCM deployment as the script itself is self contained so once it started running, SCCM was not involved until the end.
However, there have been quite a few updates to SCCM over those years and now it seems that I do have to set user interaction for the GUI to show during install\uninstall of the app. Easy to resolve and deployment works as intended

However that is not my issue
Most of the laptops have had the SCCM cache cleared over the years and even though I had set the install to be persistent, they’ve been removed.
So my idea is to use PS to copy the deployment package from the SCCM, to the CCMCache folder on the laptop and then run the “uninstall.bat” command by applying the script directly from SCCM (as a script not a package)

This uninstalls the apps, but with no GUI and as it closes down half a dozen apps with no mercy, I cannot use it.

I’ve tried various way of calling the uninstall but none of them trigger the GUI, just uninstall the app.

Uninstall.bat

.\Deploy-Application.ps1 -DeploymentType “Uninstall” -DeployMode “Interactive”

powershell.exe -Command “& { & ‘.\Deploy-Application.ps1’ -DeploymentType ‘install’ -DeployMode ‘Interactive’ ; Exit $LastExitCode }”

Deploy-Application.exe -DeploymentType “UnInstall” -DeployMode “Interactive”
}

etc

Running PS scripts from SCCM is as System but the logs says its running as Non-Interactive as System was detected.

If I remote onto the laptop and run any of those commands directly, the app is uninstalled with the GUI.

I will try the ServiceUI as I’m out of ideas!

Thank you

Maybe I missed something but… why are you running it as the System if you are needing to display a GUI to the user? Why not just run it as the User?

Because the user has no admin rights to install or uninstall apps.

Being fixed in next release.

1 Like