Script Request: Install a Chocolatey package

Hi Team,

please provide a script to install Chocolatey packages. For example… choco install firefox -y (cmd has to be run as local admin user NOT as system user). Also please note that all following questions of the install process will be granted.

Thanks

hi @msc

You can clone the Google Chrome one given below and simply change the package information to give them the required effect.

Chocolately-Install-GoogleChrome.json (489 Bytes)
Install-Chocolately.json (672 Bytes)

Thank you!

Thanks that was what I was looking for :ok_hand:

1 Like

Hey, I’m currently working on a script to run on any notebook, including installing via choco.

Because of the security implementations in Powershell you cannot click a file and let it run without turning of the execution-policy in Windows. To circumvent this you could write a batch script in the lines of:

Powershell.exe execution-policy -bypass c:\chocoinstall.ps1

Please look to Google for the correct syntax since I’m on my phone currently

Here is a sample PowerShell script to install Chocolatey packages:

Check if the script is running with administrative privileges

if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] “Administrator”)) {
Write-Warning “This script needs to be run as an administrator.”
exit
}

Install Chocolatey if it is not installed

if (-not (Get-Command choco -ErrorAction SilentlyContinue)) {
Set-ExecutionPolicy Bypass -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1’))
}

Install Firefox

choco install firefox -y