During application deployments, it is often necessary to inform active users of an ongoing installation. Many endpoint admins accomplish this by using PSADT with ServiceUI.
The combination facilitates a user interface if an explorer.exe process is running.
However, ServiceUI’s functionality relying on an active user session can lead to failures if no user is logged-in.
The script below solves this by:
1. Checking for an active user session.
2. If a user is present, running Deploy-Application.exe via ServiceUI.
3. If no user is present, running Deploy-Application.exe directly.”
Add the script to root of your PSADT toolkit and use the following install command in Intune:
Powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\DeployServiceUIOptional.ps1
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$ExplorerIsRunning=Get-ProcessExplorer-ErrorActionSilentlyContinue If($ExplorerIsRunning){ Write-Host"Launching install with ServiceUI" try{ &.\ServiceUI.exe-process:explorer.exeDeploy-Application.exe-DeploymentType"Install" }catch{ Write-Host"Failed to launch ServiceUI: $_" } }Else{ Write-Host"Launching install without ServiceUI" try{ &.\Deploy-Application.exe-DeploymentType"Install"-DeploymentMode"Silent" }catch{ Write-Host"Failed to launch Deploy-Application: $_" } } |

