Execute-Process to launch a .hta file in a task sequence

Hi All,

I am new to the PowerShell and also to the PSAppDeployToolkit.
I am running a OSD task sequence which is suppose to launch a success/failure message (.hta) file as one of the final step in the task sequence.
After doing some research I could figure out that .hta file should be called through mshta.exe.

I am not sure how the complete Execute-Process cmdlet will look like. The Current code is :

If ($Failure -eq $true){
$TSProgress = Get-Process tsprogressui -ErrorAction SilentlyContinue
if ($TSProgress) {
Execute-Process -Path “$PSScriptRoot\Files\ServiceUI.exe” -Parameters "-process:tsprogressui.exe "$PSScriptRoot\Files\FailureMsg.hta“” -ContinueOnError $true

From Task Sequence perspective if it was to be executed from the Task Sequence itself, it should have been something like below:

%ToolRoot%\ServiceUI.exe -process:tsprogressui.exe %SYSTEMROOT%\system32\mshta.exe %SCRIPTROOT%\HTA\FailureMsg.hta

I want tsprogressui.exe to first call mshta.exe, which will then execute/run the required hta file.
Is it possible?

Thanks in advance :slight_smile: