Tome's Land of IT

IT Notes from the Powertoe – Tome Tanasovski

Powerbits #5 Installing an MSI via WinRM (Remoting) with PowerShell

I had to look this one up today so I thought it was time I added it to the site as a Powerbit.  There are many ways to execute an msi remotely with PowerShell.  I find myself needing to remember how exactly to do this via WinRM on occassion. This is the technique I use to push out an msi installation in my labs.

$script = {
    #do preinstall stuff
    $args = "-i c:\path\to\msi\file.msi /qn /norestart"
    [diagnostics.process]::start("msiexec.exe", $args).WaitForExit()
    #do follow up stuff
}
invoke-command -computername (gc computerlist.txt) -scriptblock $script

You can also use WMI or schtasks to execute an MSI remotely, but that’s so last decade 🙂

Advertisements

One response to “Powerbits #5 Installing an MSI via WinRM (Remoting) with PowerShell

  1. Arnaud Petitjean April 13, 2011 at 5:59 pm

    Hey Tome!

    I love you script. I copied it on my community site (in the script repository) here : http://powershell-scripting.com.
    I hope it will not bother you; if so please let me know.

    Arnaud

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: