i have a script to install multiple msi package but I want to pause 5 minutes for the first msi installation then continue to install second msi package after 5 minutes: Please help. ( cannot find out script center in the community listed below so I place in the support session)

I am not sure where to put start-sleep…

$msi = @(‘C:\test\drive1.Wrapper.msi’,‘C:\test\driver2.msi’ )

foreach ($msifile in $msi)

{Start-Process -FilePath “$env:systemroot\system32\msiexec.exe” -ArgumentList “/i $msifile /qn /passive” -Wait}

5 Spice ups

https://stackoverflow.com/questions/1741490/how-to-tell-powershell-to-wait-for-each-command-to-end-before-starting-the-next

1 Spice up
$msi = @('C:\test\drive1.Wrapper.msi','C:\test\driver2.msi' )

foreach ($msifile in $msi) {
    Start-Process -FilePath "$env:systemroot\system32\msiexec.exe" -ArgumentList "/i $msifile /qn /passive" -Wait

 **Start-Sleep 300**
}
6 Spice ups

Cazi: That start-sleep 300 will let the first msi run, then the second msi will run after 5 minutes?

Yes. The instructions contained within the curly brackets will run for each of the MSIs.

1 Spice up

Hi, Cazi:

I did work fine but only got this error

: The term ‘’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling

of the name, or if a path was included, verify that the path is correct and try again.

At line:8 char:2

  • }

  • ~

  • CategoryInfo : ObjectNotFound: (:String) , CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

ginger, that error indicates a problem with line 8, the script Cazi gave you isn’t even 8 lines long. Did you modified it? Please post your script.

it is working but only start-sleep is not working well.

I am not sure what happened now the script only run the first one and not run the second installation:

$msi = @(‘C:\test\drive1.Wrapper.msi’,‘C:\test\driver2.msi’ )

foreach ($msifile in $msi)

{Start-Process -FilePath “$env:systemroot\system32\msiexec.exe” -ArgumentList “/i $msifile /qn /passive” -Wait }