My goal is to create a single script that I can download and run on a fresh Windows build to set up the system as much as possible. The first thing I am trying to do is install as many of the programs that I always like to have available as possible. I previously ran this (it is from chocolatey.org) to install Chocolatey directly from PowerShell:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Then I ran a bunch of choco install
s like this:
choco install googlechrome -y
choco install git -y
choco install notepadplusplus -y
choco install sql-server-management-studio -y
(I think the -y
makes them run without a prompt.)
The script should check if Chocolatey is installed and if not, run the install script. Then it should loop through a list of package names and silently install them.
- How do I detect if Chocolatey is already installed?
- How do I conditionally run the install command based on that result?
- How do I loop through a list of packages and run the
choco install
command on each?
If you have any suggestions on how to accomplish my main goal using other means, please let me know.