Issue found with Show-InstallationWelcome -BlockExecution parameter and abnormal stop

Topics: Archive - General
Apr 25, 2014 at 6:39 PM
I found a situation where the script was abnormally exited (power button hit?) in the middle of its execution where the BlockExecution parameter was used. The blocked applications would not launch after reboot and running the script again did not resolve the issue.
It seems the initial creation of the cleanup Scheduled task failed in the log below.

I was able to resolve the issue be remove the "Debugger" keys that blocked the execution in the registry manually.

Can this be prevented or looked for even though the scheduled task does not exist?
We were using version 3.0.12 for this particular deployment.

In this part of the log you can see where it tried to set a scheduled task and encountered an error.
[24-04-2014 08:32:58] [Pre-Installation] Invoking Block-AppExecution Function...
[24-04-2014 08:32:58] [Pre-Installation] Retrieving Scheduled Tasks...
[24-04-2014 08:33:04] [Pre-Installation] Exporting original IFEO registry keys to XML [C:\Users\Public\PSAppDeployToolkit\BlockedApps\NetDocuments_OfficeIntegrations_2.2.3___BlockedApps.xml]...
[24-04-2014 08:33:05] [Pre-Installation] Creating Scheduled task to cleanup blocked applications in case installation is interrupted...
[24-04-2014 08:33:05] [Pre-Installation] Retrieving Scheduled Tasks...
[24-04-2014 08:33:08] [Pre-Installation] Executing [C:\Windows\System32\schtasks.exe /Create /TN NetDocuments_OfficeIntegrations_2.2.3___BlockedApps /RU System /SC ONSTART /TR "powershell.exe -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -File 'C:\Users\Public\PSAppDeployToolkit\AppDeployToolkitMain.ps1' -CleanupBlockedApps -ReferringApplication 'NetDocuments_OfficeIntegrations_2.2.3__'"]...
[24-04-2014 08:33:08] [Pre-Installation] Working Directory is [C:\Windows\System32]
[24-04-2014 08:33:08] [Pre-Installation] Execution completed with return code -1073741502.
[24-04-2014 08:33:08] [Pre-Installation] Setting the Image File Execution Options registry keys to block execution of iexplore.exe...
[24-04-2014 08:33:08] [Pre-Installation] Setting registry key [Registry::\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\iexplore.exe] [Debugger = powershell.exe -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -File "C:\Users\Public\PSAppDeployToolkit\AppDeployToolkitMain.ps1" -ShowBlockedAppDialog -ReferringApplication "NetDocuments_OfficeIntegrations_2.2.3__"]...
[24-04-2014 08:33:10] [Pre-Installation] Spinning up Progress Dialog in a separate thread with message: [Installation in progress. Please wait...]
[24-04-2014 08:33:11] [Pre-Installation] Getting information for installed Application Name [NetDocuments Application Integrations]...
This is the point where the script abnormally exited....

The next time the script ran the scheduled task did not exist.
Write-Log "Scheduled task $schTaskBlockedAppsName already exists." missing from the log, below is proof.

Here the Pre-Installation section the next time the user let it continue:
[25-04-2014 08:02:55] [Pre-Installation] Block Execution Parameter specified.
[25-04-2014 08:02:55] [Pre-Installation] Invoking Block-AppExecution Function...
[25-04-2014 08:02:55] [Pre-Installation] Retrieving Scheduled Tasks...
[25-04-2014 08:03:02] [Pre-Installation] Exporting original IFEO registry keys to XML [C:\Users\Public\PSAppDeployToolkit\BlockedApps\NetDocuments_OfficeIntegrations_2.2.3___BlockedApps.xml]...
[25-04-2014 08:03:02] [Pre-Installation] Creating Scheduled task to cleanup blocked applications in case installation is interrupted...
[25-04-2014 08:03:02] [Pre-Installation] Retrieving Scheduled Tasks...
[25-04-2014 08:03:05] [Pre-Installation] Executing [C:\Windows\System32\schtasks.exe /Create /TN NetDocuments_OfficeIntegrations_2.2.3___BlockedApps /RU System /SC ONSTART /TR "powershell.exe -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -File 'C:\Users\Public\PSAppDeployToolkit\AppDeployToolkitMain.ps1' -CleanupBlockedApps -ReferringApplication 'NetDocuments_OfficeIntegrations_2.2.3__'"]...
[25-04-2014 08:03:05] [Pre-Installation] Working Directory is [C:\Windows\System32]
[25-04-2014 08:03:05] [Pre-Installation] Execution completed with return code 0.
[25-04-2014 08:03:05] [Pre-Installation] Setting the Image File Execution Options registry keys to block execution of iexplore.exe...
[25-04-2014 08:03:05] [Pre-Installation] Updating registry key: [Registry::\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\iexplore.exe] [Debugger = powershell.exe -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -File "C:\Users\Public\PSAppDeployToolkit\AppDeployToolkitMain.ps1" -ShowBlockedAppDialog -ReferringApplication "NetDocuments_OfficeIntegrations_2.2.3__"]...
Here is the Post Installation Section:
[25-04-2014 08:03:31] [Post-Installation] Invoking UnBlock-AppExecution Function...
[25-04-2014 08:03:31] [Post-Installation] Restoring the original Image File Execution Options registry key for iexplore.exe...
[25-04-2014 08:03:31] [Post-Installation] Updating registry key: [Registry::\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\iexplore.exe] [Debugger = powershell.exe -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -File "C:\Users\Public\PSAppDeployToolkit\AppDeployToolkitMain.ps1" -ShowBlockedAppDialog -ReferringApplication "NetDocuments_OfficeIntegrations_2.2.3__"]...
[25-04-2014 08:03:32] [Post-Installation] Removing CliXML [C:\Users\Public\PSAppDeployToolkit\BlockedApps\NetDocuments_OfficeIntegrations_2.2.3___BlockedApps.xml]...
[25-04-2014 08:03:32] [Post-Installation] Deleting File(s) [C:\Users\Public\PSAppDeployToolkit\BlockedApps\NetDocuments_OfficeIntegrations_2.2.3___BlockedApps.xml]...
[25-04-2014 08:03:32] [Post-Installation] Retrieving Scheduled Tasks...
[25-04-2014 08:03:34] [Post-Installation] Deleting Scheduled Task [NetDocuments_OfficeIntegrations_2.2.3___BlockedApps] ...
[25-04-2014 08:03:34] [Post-Installation] Executing [C:\Windows\System32\schtasks.exe /Delete /TN NetDocuments_OfficeIntegrations_2.2.3___BlockedApps /F]...
[25-04-2014 08:03:34] [Post-Installation] Working Directory is [C:\Windows\System32]
[25-04-2014 08:03:34] [Post-Installation] Execution completed successfully with return code 0.
Coordinator
Apr 29, 2014 at 1:52 PM
The latest 3.1.x releases should have any issues with Block Execution fixed. We spent a lot of time trying to sort this out, and I haven't seen the issue reoccur in production since.

Cheers, Dan