30. PS App Deployment Toolkit - PowerShell Script check process (30/33)

preview_player
Показать описание


## Author: John Bryntze
## Date: 25th October 2021
## Version: 1.0

if ($JBNChromeProcesses.Count -eq 0) {
Try {
Write-Output "Google Chrome is not started, we can run the installation in session 0"
}
Catch {
$ErrorMessage = $_.Exception.Message
$ErrorMessage
}
}
else {
Try {
Write-Output "Google Chrome is started, we need to run the installation in session 1, ServiceUI.exe"
}
Catch {
$ErrorMessage = $_.Exception.Message
$ErrorMessage
}

}

Write-Output "Exit Code of installation is: $LASTEXITCODE"
exit $LASTEXITCODE
Рекомендации по теме
Комментарии
Автор

Great videos. Would this be the same scenario if we are deploying with SCCM console instead of INTUNE?

greatvocals
Автор

Hi, I have an error when your code is executed. "The term '.\ServiceUI.exe is not recognized as the name of a cmdlet, function, script file, or operable program." Can you check why? many thanks

stephanegva
Автор

How would you edit this script so that you can check if Multiple Apps are closed or not? Word PowerPoint and Outlook need to be closed for my app to run

begobogo
Автор

Hi, Great Video's Thanks a lot for this. I have one issue.
I use a simple application, Paint_dot_net. And I want Chrome to be closed, just for learning purposes.
But when a user chooses "Defer" the script will always exit with a success (0). It should be 60012.
I think that is because you are calling ServiceUI.exe which exits with a success
Do you have the same issue?

This is my command (Somewhat different then yours):

Start-Process -FilePath $PSScriptRoot\ServiceUI.exe -ArgumentList "-process:explorer.exe -WindowStyle Hidden -Wait -PassThru

Do you have the same issue? I was hoping the -PassThru with would solve this, it doesn't

jmbsubsense