Run multiple programs from Powershell script

Posted on 2009-12-20
Medium Priority
Last Modified: 2012-06-27
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?

Question by:APAGroup
  • 2
LVL 10

Accepted Solution

wmeerza earned 500 total points
ID: 26093819

Author Closing Comment

ID: 31668382
I had good success with the [diagnostics.process]::start("notepad.exe").WaitForExit() method.


# Install Communicator
[diagnostics.process]::start("msiexec.exe","-i communicator.msi /qb!").WaitForExit()

# Install Latest Communicator Patch
[diagnostics.process]::start("msiexec.exe","-p communicator.msp /qb! /norestart").WaitForExit()
LVL 10

Expert Comment

ID: 26100774

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Loops Section Overview

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question