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.
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:
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’))
}