Skip to content

Instantly share code, notes, and snippets.

@aspen-roller
Created October 1, 2020 20:20
Show Gist options
  • Save aspen-roller/1ac6e50c7b09c0f850f7fd1c4b4a572c to your computer and use it in GitHub Desktop.
Save aspen-roller/1ac6e50c7b09c0f850f7fd1c4b4a572c to your computer and use it in GitHub Desktop.
Chocolatey install packages
$chocolateyAppList = "googlechrome,firefox,redis-64,7zip,dotnetcore-sdk,dotnetcore-windowshosting"
$dismAppList = "IIS-ASPNET45,IIS-CertProvider,IIS-ManagementService"
Invoke-Expression "InstallApps.ps1 ""$chocolateyAppList"" ""$dismAppList"""
# https://octopus.com/blog/automate-developer-machine-setup-with-chocolatey
Param(
[string]$chocolateyAppList,
[string]$dismAppList
)
if ([string]::IsNullOrWhiteSpace($chocolateyAppList) -eq $false -or [string]::IsNullOrWhiteSpace($dismAppList) -eq $false)
{
try{
choco config get cacheLocation
}catch{
Write-Output "Chocolatey not detected, trying to install now"
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
}
if ([string]::IsNullOrWhiteSpace($chocolateyAppList) -eq $false){
Write-Host "Chocolatey Apps Specified"
$appsToInstall = $chocolateyAppList -split "," | foreach { "$($_.Trim())" }
foreach ($app in $appsToInstall)
{
Write-Host "Installing $app"
& choco install $app /y | Write-Output
}
}
if ([string]::IsNullOrWhiteSpace($dismAppList) -eq $false){
Write-Host "DISM Features Specified"
$appsToInstall = $dismAppList -split "," | foreach { "$($_.Trim())" }
foreach ($app in $appsToInstall)
{
Write-Host "Installing $app"
& choco install $app /y /source windowsfeatures | Write-Output
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment