Skip to content

Instantly share code, notes, and snippets.

@mwallner
Created May 15, 2018 07:58
Show Gist options
  • Save mwallner/06a38bab51bb4cc7b40edb9b92a4c446 to your computer and use it in GitHub Desktop.
Save mwallner/06a38bab51bb4cc7b40edb9b92a4c446 to your computer and use it in GitHub Desktop.
install a chocolatey package with boxstarter using chocolatey sources
param(
$pkg
)
$chococfg = "C:\ProgramData\chocolatey\config\chocolatey.config"
if (-Not $(Test-Path $chococfg)) {
throw "choco config not found!"
}
[xml]$cfg = Get-Content $chococfg
$nugetSources = ""
$cfg.chocolatey.sources.source | Foreach-Object {
if ($_.disabled -eq $false) {
$nugetSources += "$($_.Value);"
}
}
Write-Output "using sources: '$nugetSources'"
Set-BoxstarterConfig -NugetSources $nugetSources
$Boxstarter.RebootOk=$true
$Boxstarter.NoPassword=$false
$Boxstarter.AutoLogin=$true
$user=[System.Environment]::UserName
$domain=[System.Environment]::UserDomainName
$_cred=Get-Credential "$domain\$user"
Install-BoxstarterPackage $pkg -Credential $_cred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment