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!