r/Intune•
JayMillah

Using PSADT's Invoke-ServiceUI function

App Deployment/Packaging

Some of you may know that with PSADT 3.10, there's an example using the Invoke-ServiceUI.ps1 script

https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/tree/main/Examples/ServiceUI

The idea is that when an app is detected as running, PSADT will deploy in interactive mode, if not running, it deploys silently. This is working fine when testing locally but I'm running into problems with Intune where it will forcefully close an app and run PSADT in NonInteractive mode even if the app is running, and it looks to be related to Get-Process on line 43

I'm using the following install command in Intune

%Systemroot%\System32\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy Bypass -NoProfile -File .\Invoke-ServiceUI.ps1 -DeploymentType Install -ProcessName 'notepad++'

I've tested using %windir%, %windir%\sysnative, different processes such as wireshark, and I've also edited Invoke-Service.ps1 to pipe Get-Process to a text file and there's no output. Any help is appreciated

Posted May 21, 2024, 6:56 PM UTC

51
DenverITGuy•

Are you working with Notepad++ x86 or x64?

You mentioned no output from Get-Process which makes me think that the powershell execution was x86 and couldn't find the x64 process.

I had an issue like this recently and had a great response in the powershell sub.

https://www.reddit.com/r/PowerShell/comments/1coo8pe/powershell_system_context_issue/

2
Pollewops65•

Already got this fixed? I would like to use with scheduled task which runs by SYSTEM account.

1