guilherme.oc97
guilherme.oc97

Reputation: 451

Skip confirmation while using Install-Package?

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?

Upvotes: 13

Views: 41276

Answers (2)

Pavel Stoev
Pavel Stoev

Reputation: 21

choco feature enable -n allowGlobalConfirmation

will suppress license and other prompts during install.

Set-PackageSource -Name chocolatey -Trusted

will set package source as trusted.

Upvotes: 2

Random206
Random206

Reputation: 826

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.

Upvotes: 26

Related Questions