Powershell Script To Install Msi

April, 11, 2018 “How to run PowerShell script from MSI in PACE Suite?” – that is the question we often recieve during our product demo. Indeed, PowerShell remains a favourite tool of system administrators because they can script alsmost any task with PowerShell (by the way, here is a handy guide on creating and editing scripts from Microsoft).

Posted by4 years ago
Archived

Let me preface this by saying I am really new to PS so please be gentle. I am trying to write a simple script to install an internal application in quiet mode. My environment is Windows 7 32 bit. To call the script, I am simply running a batch file:

Powershell -File Install.ps1

This is triggering without issue. For inside the PS1, I have tried multiple ways of initiating a quiet install: call the MSI directly, call msiexec , use start-process to call both previous methods, etc. no matter what I do, I can't seem to get the MSI to install in quiet mode via powershell. It works fine from command prompt. It works fine if I drop the /quiet attribute from powershell. However, once I put the /quiet attribute on, I see the msiexec.exe hits task manager but never installs.

My latest attempt for the command is:

Msiexec.exe /i c:psinstall.msi /quiet

As I stated, if I drop the quiet, I get the install interface and if I run this in command prompt, it installs without issue.

Any help that anyone could provide would be much appreciated.

Also, any recommendations for learning Powershell better would be much appreciated. I have a background in some programming and a lot of work with batch files so I am pretty much piecing it together by googling specifically what I am trying to accomplish. CBT Nuggets is in my queue but other technologies are taking priority at this time.

15 comments
Active1 year, 4 months ago

I am very new to PowerShell and have some difficulty with understanding.
I want to install an .MSI inside PowerShell script.
Can please explain me how to do that or provide me beginners level tutorial.

JasonMArcher
10k10 gold badges49 silver badges49 bronze badges
New DeveloperNew Developer
1,6598 gold badges34 silver badges67 bronze badges

7 Answers

Why get so fancy about it? Just invoke the .msi file:

or

Edit: Full list of Start-Process parameters

Stein Åsmul
25.7k15 gold badges61 silver badges129 bronze badges
Adi InbarAdi Inbar
9,42911 gold badges42 silver badges63 bronze badges

I've searched all over for this myself and came up with zilch but have finally cobbled this working script together. It's working great! Thought I'd post here hopefully someone else can benefit. It pulls in a list of computers, copies the files down to the local machines and runs it. :) party on!

Stein Åsmul
25.7k15 gold badges61 silver badges129 bronze badges
bonedog73bonedog73

A person who is totally new to PowerShell or other command shells might be confused by the <path> part in @Adi's answer.

to find the value of your path using windows GUI, right click on the .msi file, select 'properties', then 'details'. under 'Folder path' you will see what needs to be written for .

so your command would look like (for example)

this is obvious to most people who use StackOverflow, but a true newbie can easily go astray.

neontapir
4,0023 gold badges32 silver badges50 bronze badges

Powershell Script To Install Msu

ngksngks

When trying to silently install an MSI via PowerShell using this command:

Uninstall

I was getting the error:

The specified executable is not a valid application for this OS platform.

I instead switched to using msiexec.exe to execute the MSI with this command, and it worked as expected:

Hopefully others find this useful.

Powershell Script To Install Msi On Mac

deadlydog

Powershell Script To Install Msi And Mst

deadlydog
14.8k11 gold badges78 silver badges84 bronze badges

You can use:

You can also add some more optional parameters. There are common msi parameters and parameters which are specific for your installer. For common parameters just call msiexec

Andrey MarchukAndrey Marchuk

After some trial and tribulation, I was able to find all .msi files in a given directory and install them.

Stein Åsmul

Powershell Script To Install Msi Remotely

25.7k15 gold badges61 silver badges129 bronze badges
micsea64micsea64
Stein Åsmul
25.7k15 gold badges61 silver badges129 bronze badges

Powershell Script To Install Msi Package

sumitsumit

Powershell Msiexec Uninstall

Not the answer you're looking for? Browse other questions tagged powershellwindows-installer or ask your own question.