I would like to just update this topic to provide more information that was just found in testing.
The original issue posed was regarding installing an app (VSCode) into the user profile and then running that app as the system account or as an admin. In this scenario, which was pointed out was not standard practice, when you ran a new install with the app opened as system or admin, the Show-ADTInstallationWelcome prompt would error. All this can be observed in previous comments in this thread.
The new info is that if I install VSCode per-machine and then try to upgrade it with a PSADTv4 script with the app opened as system or admin, I get the same error with Show-ADTInstallationWelcome as I did with the app installed per-user and opened as system or admin. If the app is running as the logged on user, the Show-ADTInstallationWelcome acts fine.
Now I can understand that this could possibly be an excusable error when opening an app within a user’s profile as another user (system or admin), but it is common practice to do this with a per-machine install.
*EDIT: As explained previously in this thread, the scenario is only occurring if I have the parameter AllowDeferCloseApps set on the Show-ADTInstallationWelcome cmdlet. If I remove that parameter and only use AllowDefer, it doesn’t matter if the app is opened using any account (logged on user, System, or admin), it will show the Defer prompt without issue. @mjr4077au - I don’t know how my environment would treat parameters on a cmdlet differently, especially when this was not an issue with v3 in my environment. I don’t rule it out, but to me it seems unlikely.
It is going to be difficult, in my environment, to use the AppDeployToolkit, if the Toolkit cannot close a process opened as system or admin. Our logged on user accounts do not have access to do much, short of running applications. So, it would be a common occurrence for a user to elevate their app to gain the necessary rights, especially when the app is a Developer app, like VSCode.
I don’t recall this being an issue in PSADTv3. Can anyone else replicate this issue, or is it just me?
Here is a screenshot of the error when running the uninstall of VSCode with VSCode running with an admin account…
