2
Get-Url http://dl.google.com/chrome/install/375.126/chrome_installer.exe c:\temp\chrome_installer.exe;
c:\temp\chrome_installer.exe /silent /install;

I have the following. But I would also lke to install other applications after chrome. Is this a correct approach or will I have issue as powershell has no idea when one install finished and when to start another?

Should I go the MSI route instead?

2 Answers 2

6

You can use Start-Process with the -Wait parameter, most install files will work with this method however this will not work if the installer opens other files and closes itself (As PowerShell is only waiting for the installer to close)

I don't have the Get-Url function to test the following code but it should work:

The first Start-Process will launch the installer for Chrome and than wait for the window to close before running the second Start-Process.

Get-Url http://dl.google.com/chrome/install/375.126/chrome_installer.exe c:\temp\chrome_installer.exe
Start-Process -FilePath 'c:\temp\chrome_installer.exe' -ArgumentList '/silent', '/install' -Wait
Start-Process -FilePath 'C:\temp\DifferentProgram.exe' -ArgumentList '/argument' -Wait
Sign up to request clarification or add additional context in comments.

Comments

1

Sorry that I can't comment on @Bluestacks answer

You can wrap commands with:

$appsetup = Start-Process -FilePath 'c:\temp\chrome_installer.exe' -ArgumentList '/silent', '/install' -PassThru -Wait

Then test for successful completion with .exitcode (make sure -PassThru is used)

If ($appsetup.exitcode -eq 0) write-host "Install completed without errors"

If you need anything more substantial try PowerShell App Deployment ToolKit on Gitub

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.