Skip confirmation while using Install-Package?

guilherme.oc97 picture guilherme.oc97 · Apr 23, 2017 · Viewed 22.6k times · Source

I have added ChocolateyGet as a provider on Powershell so I can use it with PackageManagement (OneGet), it works but every package I try to install warns:

https://www.chocolatey.org is not a trusted package source

Then asks for confirmation. It also asks me if I agree to the license of the package.

I wanted to make a script to automatically install some packages, but I needed this script to be unattended, and it's not possible now because it asks those two previous questions.

Is there anyway to circumvent/automatically respond these confirmations? Like the y or yes command on Linux?

Answer

Random206 picture Random206 · Apr 23, 2017

You need to use -Force where there is a Force property available on any cmdlets, otherwise if there isn't but there is a confirm, you are able to use -Confirm:$False which acts the same as pressing Yes.

Be careful using this however as if you in fact didn't want to process the action...you don't get a second chance.