Issue with Execute-Patch in imaging task sequence, latter half of script being ignored

We’re deploying MBAM in an imaging task sequence, core msi + 3 patches. There are no errors in the log, the msi installs every time. The log detects that it’s running in a task sequence. After installing the msi the script exits and the msps are not applied.

However, if the application is run outside of imaging, it installs and pushes all the patches just fine.

I’m guessing it’s something like msiexec/wmi hasn’t fully enumerated the install of the msi and so its skipping the msps because it doesn’t think they apply—but I would suspect that to be borne out in logs, and it’s not.

I suspect I can probably just use msiexec to force the patch installs without all the fanciness of psadt but I’m curious if there’s something I just don’t know / understand about execute-msp and/or how apps are installed in task sequences. I added sleeps thinking they might give the system time to catch up, but they do no such thing.

		Execute-MSI -Action "Install" -Path 'MbamClientSetup-2.5.1100.0.msi'
		Start-Sleep -s 30
		Execute-MSP -Path 'MBAM2.5_Client_x64_KB4041137.msp'
		Start-Sleep -s 30
		Execute-MSP -Path 'MBAM2.5_Client_x64_KB4340040.msp'
		Start-Sleep -s 30
		Execute-MSP -Path 'MBAM2.5_Client_x64_KB4505175.msp'
		Start-Sleep -s 30

Find out what is causing the reboot using PSADT’s log file.
I’m betting it’s the MSI. BTW: consider forcing the MSI to create a log file.

Thanks for the response, I know that you’re busy.

There’s no reboot—it just ends, and the logs show nothing, they just stop. Exit with exit code 0.

I keep verbose logging on all the things–the execute-msi gets a verbose log (and it has a log that I’ve checked, no errors), but the patches are just totally skipped unless it runs after the task sequence is finished.

What’s even more weird is that it doesn’t appear to always happen that way. I know that just adds variables, but it’s the entire lack of log output that’s most vexing. SMSTS.log isn’t helpful either.

Since you are stating the PSADT log file just dies midway during the Start-Sleep -s 30 after it installs the MSI, I think MSI or something else is causing the reboot.

To prove this, try the following and I bet ya it doesn’t get very far.
Either way it will tell us what’s going on.

Get-PendingReboot | Out-String | Write-Log
Write-Log "installing MBAM client"
Execute-MSI -Action "Install" -Path 'MbamClientSetup-2.5.1100.0.msi'
Write-Log "MSI install done"
Get-PendingReboot | Out-String | Write-Log
Start-Sleep -s 5
Get-PendingReboot | Out-String | Write-Log
Start-Sleep -s 5
Get-PendingReboot | Out-String | Write-Log
Start-Sleep -s 5
Get-PendingReboot | Out-String | Write-Log
Start-Sleep -s 5
Get-PendingReboot | Out-String | Write-Log
Start-Sleep -s 5
Get-PendingReboot | Out-String | Write-Log
Start-Sleep -s 5

Write-Log "installing MBAM MSP"
Execute-MSP -Path 'MBAM2.5_Client_x64_KB4041137.msp'
Start-Sleep -s 30

Try

Execute-Process -Path 'msiexec.exe' -Parameters "/p `"$dirFiles\MBAM2.5_Client_x64_KB4041137.msp`" /qn /norestart"