Run multiple programs from Powershell script
Posted on 2009-12-20
I need to replace a VB script with a Powershell script. The script installs the components for Microsoft Office Communicator. For example,
' Install Communicator
call WSHShell.Run ("msiexec -i communicator.msi /qb! /norestart",1,True)
' Install Latest Communicator Patch
call WSHShell.Run ("msiexec -p communicator.msp /qb! /norestart",1,True)
I am trying to do the same with Powershell using:
# Install Communicator
Invoke-Expression -Command "msiexec -i communicator.msi /qb!"
# Install Latest Communicator Patch
Invoke-Expression -Command "msiexec -p communicator.msp /qb! /norestart"
The trouble is that the second program does not wait for the first program to finish. How can I force each program to wait until the previous program has finished?