I have noticed that some of my deployments failed and when examining the logs I noticed that somewhere half way through an installation the user suddely "deferred" the installation.
this was a suprise as it should be possible to do that at the Welcome wizard phase, but not half way through an installation. So I started looking around why that was and I think it happens because of a combination of factors:
- I advertise my deployment on a recurring schedule of 3h
- offer the users 2 delays
- users are a pain and will try to delay more by ignoring the welcome wizard (even though I persist it!)
So what do I get: After either the alotted time for a retry of the advertisement, or after usage of sleep/standby and a catch-up run of the SCCM agent to force the missed iteration of the advertisement, there is no check by the powershell app toolkit to if there is already an installation in progress and you get a second run. The user will happely push on the defer again (or annoyed because it came up again when the finally decided to get the installation done only moments ago) and by deferring the second the first one is aborted just as well.
I simulated this by starting up an install manually, and letting SCCM kick in when it thinks it needs too.
the logs show: (first 6 lines are from the initial script, running an uninstall as part of the pre-reqs). Suddenly interrupted by a deferral which should not be possible at that moment:
```
[10-04-2014 13:55:00] [Pre-Installation] Updating Progress Message: [Remove Currently installed Netclient 8.7.2.3004]
[10-04-2014 13:55:01] [Pre-Installation] Executing [CScript.Exe C:\Windows\SysWOW64\CCM\Cache\UK200459.20.System\Files\Uninstall_AGNC.vbs]...
[10-04-2014 13:55:31] [Pre-Installation] Execution completed successfully with return code 0.
[10-04-2014 13:55:32] [Pre-Installation] Updating Progress Message: [NDIS cleanup..]
[10-04-2014 13:55:32] [Pre-Installation] Executing [C:\Windows\SysWOW64\CCM\Cache\UK200459.20.System\SupportFiles\ud_fix\x64\ndiscleanup -cleanup -if 1]...
[10-04-2014 13:55:32] [Pre-Installation] Working Directory is [C:\Windows\SysWOW64\CCM\Cache\UK200459.20.System\SupportFiles\ud_fix\x64]
__[10-04-2014 13:55:41] [Pre-Installation] Installation deferred by the user.__
[10-04-2014 13:55:41] [Pre-Installation] Setting deferral history...[DeferTimesRemaining = 1]
[10-04-2014 13:55:41] [Pre-Installation] Creating Registry key [Registry::\HKEY_LOCAL_MACHINE\SOFTWARE\PSAppDeployToolkit\DeferHistory\AT&T_GlobalNetworkClient_9.2.1(INTL)_EN_01]...
[10-04-2014 13:55:41] [Pre-Installation] Setting registry key [Registry::\HKEY_LOCAL_MACHINE\SOFTWARE\PSAppDeployToolkit\DeferHistory\AT&T_GlobalNetworkClient_9.2.1(INTL)_EN_01] [DeferTimesRemaining = 1]...
[10-04-2014 13:55:41] [Pre-Installation] AT&T_GlobalNetworkClient_9.2.1(INTL)_EN_01 Installation completed with exit code [5000].
```
I have since upgraded to the 3.1.1 release, advertised the deployment to a test machine and just let it stand there. After a while I have 2 "show-Installationprompt" popups. The first one will eventually fail after the default 1.55h. I deferred on the second after 20m :
```
[22-04-2014 15:33:13] [Pre-Installation] Installation not actioned within a reasonable amount of time.
[22-04-2014 15:33:13] [Pre-Installation] AT&T_GlobalNetworkClient_9.2.1(INTL)_EN_01 Installation completed with exit code [1618].
[22-04-2014 15:33:13] [Pre-Installation] ----------------------------------------------------------------------------------------------------------
[22-04-2014 15:51:13] [Pre-Installation] User did not want to disconnect yet.
[22-04-2014 15:51:13] [Pre-Installation] AT&T_GlobalNetworkClient_9.2.1(INTL)_EN_01 Installation completed with exit code [5001].
[22-04-2014 15:51:13] [Pre-Installation] ----------------------------------------------------------------------------------------------------------
```
So is it not possible to build in some sort of detection that prevents this kind of double starting of the same deployments? (or just any deployment)...?
thanks for your attention. Hope you are able to simulate this
regards
Maarten
Comments: Unfortunately you might have a variety of other PowerShell windows open for valid reason and then your install won't run. More importantly, if you're running using a scheduled task you miss out on the benefits of SCCM driving the install. One thing that could easily happen is that an SCCM deployment kicks off at the same time as your scheduled task and they both interfere with each other (ie, two MSIs cannot install at the same time).
Are you sure a reboot is required? We've updated VPN clients here without a reboot providing all processes and services are stopped. A better way of doing this might be to set up your install as a standard application. In your script:
Pre-install phase
* Detect previous version and remove if found
* If previous version, Show-InstallationRestartPrompt
* If previous version, Exit Script
* If previous version, create scheduled task to run the following script
# Execute the Application Global Evaluation Task
$cpAppletMgr = New-Object -ComObject CPApplet.CPAppletMgr
$applicationPolicy = $cpAppletMgr.GetClientActions() | Where-Object { $_.Name -eq "Application Global Evaluation Task" }
$applicationPolicy.PerformAction()
Install phase
* Install new version
Post-Install phase
* Remove scheduled task if found
Since your detection in the application would be based on the new version, after your reboot the scheduled task script runs, SCCM evaluates that it's not installed and reruns the installation. The Pre-Install phase is skipped and the app installs.
Make sense?
Gonna close this off.
Dan