Created
October 24, 2024 10:20
-
-
Save DMeurer/3b807e98c6ba87ac0bd074b7e7953023 to your computer and use it in GitHub Desktop.
Install a chocolately package and chocolately if not already installed. You have to run `Set-ExecutionPolicy remotesigned` to execute the script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install Chocolately | |
If(Test-Path -Path "$env:ProgramData\Chocolatey") { | |
echo "Chocolately is installed" | |
} Else { | |
echo "Chocolately is not installed. Installing now..." | |
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | |
echo "Chocolately is installed" | |
} | |
# reload path | |
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") | |
# install stuff | |
$Packages = 'eclipse', 'git' | |
ForEach ($PackageName in $Packages) | |
{ | |
choco install $PackageName -y | |
} | |
# reload path again | |
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment