I have an improvement I’d like to make to our PSADT deployments so they act more silently for the user when doing the installs.
Let me explain…
Using Azure Data Studio as my example, In the PRE-INSTALLATION section of our deployments, I have:
This is fine if the azuredatastudio process is running when the install lands as it prompts the user to close the app before notifying them the installation is in progress via the use of Show-InstallationProgress, but, if the azuredatastudio process is not running when the install lands I would prefer that the install does not display Show-InstallationProgress - Why bother telling the user we are updating an app they are not currently using?
I’m guessing that it would require the Show-InstallationWelcome function to be modified so it has an output (e.g. ‘appsrunning’) which could be tested before deciding if the Show-InstallationProgress should be displayed?
I think I’m answering my own question here, without a modification of the function mentioned above - do I need to check for the existence of the running process before the Show-InstallationWelcome command?, so that the code would look like:
if (Get-Process azuredatastudio -ErrorAction SilentlyContinue) {
#Process is running
Show-InstallationWelcome -CloseApps 'azuredatastudio=Azure Data Studio' -BlockExecution -MinimizeWindows $false -AllowDeferCloseApps -DeferTimes 3 -CheckDiskSpace -PersistPrompt -TopMost $true
Show-InstallationProgress
} else {
#Process is not running
Show-InstallationWelcome -CloseApps 'azuredatastudio=Azure Data Studio' -BlockExecution -MinimizeWindows $false -AllowDeferCloseApps -DeferTimes 3 -CheckDiskSpace -PersistPrompt -TopMost $true
}
To me the scenario you describe and the code in the “else” statement is somewhat inconsistent. You say that you don’t want to bother the user if the process is not running but you use the Defer functionality so the user will get prompted 3 times regarding the update. I would remove the Deferal part to make it more “silent” in that scenario.
P.S. I have the Apps to Close defined as a Variable so I can re-use for the Installation and Uninstallation sections - here is an example from my Adobe Acrobat Pro DC script containing each of the process names and Friendly names:
It’s not rocket science, but I have a block of code that will convert this process and friendly name string to just the list of process names into a $ProcessestoClose variable
# Convert the $AppstoClose string to just a list of processes to close
# Split the string by commas
$processArray = $AppstoClose.Split(',')
# Extract the process names
$ProcessestoClose = $processArray.ForEach{
if ($_ -match "=") {
$_.Split('=')[0]
} else {
$_
}
}
This then allows me in each script to use the $ProcessestoClose variable in my ‘check if a process is running’ block, this way, I only have to maintain a single list of processes and friendly names that affect this install:
if (Get-Process $ProcessestoClose -ErrorAction SilentlyContinue) {
...
Recently I was asked to install apps silently without GUI so users are not disturbed with a random popup of XYZ is installing.
This is how we achieved that, if it helps someone.
We defined the processes to terminate in the $variables at the top,