Is it possible to have the deferal popup ONLY if the process is running? Right now i have to choose between either allowing the user to defer regardless of the process running or removing -AllowDefer and forcing the user to install if the process is running.
not exactly, what you’re asking for, but i think this may guide you in the right direction.
First of all: We’re deploying with SCCM, so per (our) default, the Process runs in noninteractive mode, unless the user hits “(Un)install” in the Softwarecenter. By doing that it’s automatically run in interactive mode.
So here’s what we’re doing:
SWITCH ( <Get your running processes you want to close> ) {
{ $_ -eq '' -or $_ -eq $null } {
Show-InstallationWelcome -CheckDiskSpace -PersistPrompt -RequiredDiskSpace $([UINT32]($RequiredDiskSpaceInKB / 1024))
}
DEFAULT {
If ( $deployMode -eq 'Interactive') {
Show-InstallationWelcome -CheckDiskSpace -PersistPrompt -RequiredDiskSpace $([UINT32]($RequiredDiskSpaceInKB / 1024)) -CloseAppsCountdown 1800 -CloseApps $_ -AllowDeferCloseApps -DeferTimes 5
} else {
Write-Log " DeployMode is not Interactive (deployMode: $($deployMode)) and there are Applications to close: $($_)" -Source "Close Running Apps"
Write-Log (" Aborting {0}ation now!" -f $deploymentType) -Source "Close Running Apps"
Exit-Script -ExitCode 1618
}
}
}
So if the Toolkit is run in noninteractive mode, and there are processes which needs to be closed, it will exit with 1618, which will tell SCCM to retry the Un/Installation again in about 10 minutes and raise a failure.
If the user then hit’s “retry” in softwarecenter, it’s automatically run in interactive mode and the user will geht a prompt.
If there are no processes running, it will just go on doing things and stuff.
Hi BaBa,
This one is very interesting and i can definitely see a use for this one in my environment. Not quite what i was looking for in this instance tough.