1

I am new in power shell. i need to install file using powershell. My msi file location is C:\Amazon\AWSCLIV2.

I have tried with the powershell script Start-Process C:\Amazon\AWSCLIV2.msi

When i executing the above script gets installation windows. ie; click to next to install(Displayed window) the above msi file(i need to remove this window). but actually i want, installation should works automatically when executing powershell script.

So i need to execute installation using powershell script.

16
  • This should basically work the same way as with cmd. Run msiexec /? if you need help on how to do a silent install of an msi, logging etc. Commented Mar 10, 2021 at 7:10
  • Thanks for the reply. can you give exact powershell script? i mean where to attach msiexec /? script in Start-Process C:\Amazon\AWSCLIV2.msi Commented Mar 10, 2021 at 7:14
  • No, I mean if you run msiexec /? by itself you will see the options, such as /quite. Commented Mar 10, 2021 at 7:26
  • i got a window when executing msiexec /? command. i don't understand the window. can you give the solution? Commented Mar 10, 2021 at 7:34
  • @notjustme can you help me? Commented Mar 10, 2021 at 8:00

1 Answer 1

2

I use the following to run all my msi installs from within a PowerShell script.

$Args = @("/qn", "/i", "<msifile.msi>")
Start-Process "msiexec.exe" -ArgumentList $Args -Wait -NoNewWindow

I always put the msiexec.exe arguments in a separate variable to make the command easier to read for my colleagues who have less PS experience. It also makes it easier to pass a variable into the argument list as below.

$Args = @("/qn", "/i", "$MSIName")

-Wait instructs the script to wait until the process you start has finished before the script continues

-NoNewWindow ensures no additional windows are displayed in the course of the process.

You can even add transforms into the argument list with no difficulty.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.