Keep getting - Launching this application has been temporarily blocked so that an installation operation can complete

I don’t know if it’s because I’ve tried to install the application multiple times and it’s left lingering objects in the registry, but my installation pops this up twice during my installation. If I hit OK on both instances, it runs through fine. What is the cause?

image

It depends what you are deploying…
Some applications run themselves silently as part of the setup, so it might be this that is occuring

Can you paste a few lines either side of the command that contains the -BlockExecution switch and we may be able to advise
N.B. Remember to use the pre-formatted text button on the toolbar </> to insert your code

function Install-ADTDeployment {$adtSession.InstallPhase = ‘Pre-Install’

Show-ADTInstallationWelcome `
  -CloseProcesses `
    @{ Name='WINWORD'; Description='Microsoft Word' }, `
    @{ Name='EXCEL'; Description='Microsoft Excel' }, `
    @{ Name='OUTLOOK'; Description='Microsoft Outlook' }, `
    @{ Name='POWERPNT'; Description='Microsoft PowerPoint' }, `
    @{ Name='ONENOTE'; Description='Microsoft OneNote' }, `
    @{ Name='TEAMS'; Description='Microsoft Teams' } `
  -PromptToSave `
  -AllowDefer `
  -DeferTimes 3 `
  -CloseProcessesCountdown 600 `
  -BlockExecution

Show-ADTInstallationProgress -StatusMessage 'Installing X...'

$adtSession.InstallPhase = 'Install'
$installer = "$($adtSession.DirFiles)\X.exe"
$logPath = 'C:\Windows\Temp\X_install.log'

# Include Office=64 for 64-bit install
$msiArgs = "/Office=64 /v""INSTALLDIR=C:\Y\X /L*v `"$logPath`""""
Start-ADTProcess -FilePath $installer `
  -ArgumentList '/s', $msiArgs `
  -WindowStyle Hidden -WaitForMsiExec

Write-ADTLogEntry -Message "X installer exit code: $LASTEXITCODE" -Severity 1
Start-Sleep -Seconds 5

$adtSession.InstallPhase = 'Post-Install'

if (Test-Path ‘C:\Y\X’) {Remove-ADTRegistryKey       -Key "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\X.exe"-Name Debugger `-ErrorAction SilentlyContinue

Unblock-ADTAppExecution

Show-ADTInstallationPrompt `
  -Message 'X installed successfully.' `
  -ButtonRightText 'OK'
Close-ADTSession -ExitCode 0

}}


I think this is what you wanted to see? Some stuff may not be needed as I was testing a lot from Googling like the end unblock-adtappexecution. It’s from Invoke-AppDeployToolkit.ps1

In some older versions of 4.0.x, there were issues with the toolkit not unblocking correctly. I’d suggest cleaning the offending registry keys manually, then testing again with 4.1.0 where most of this code has been refactored as part of the client/server stuff.

Lastly, you don’t need to explicitly call Unblock-ADTAppExecution as when Block-ADTAppExecution is called within Show-ADTInstallationWelcome, a callback is added so that Unblock-ADTAppExecution is called within Close-ADTSession for you.

Man, 4.1.0 looks different. I’ll give it a whirl and report back.

The thing is none of the “offending” registry keys are on the system, so I don’t know why it’s throwing the alarms.