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).
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.
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.
7 Answers
Why get so fancy about it? Just invoke the .msi file:
or
Edit: Full list of Start-Process parameters
Stein ÅsmulI'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 ÅsmulA 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.
neontapirPowershell Script To Install Msu
When trying to silently install an MSI via PowerShell using this command:
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
deadlydogPowershell Script To Install Msi And Mst
deadlydogYou 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
After some trial and tribulation, I was able to find all .msi files in a given directory and install them.
Stein Åsmul