Skip to content

Instantly share code, notes, and snippets.

@aclk
Created August 7, 2021 08:07
Show Gist options
  • Save aclk/0633f97dd6aecf5936a9cc6ccec47ce4 to your computer and use it in GitHub Desktop.
Save aclk/0633f97dd6aecf5936a9cc6ccec47ce4 to your computer and use it in GitHub Desktop.
install chocolate with powershell
$creds = Get-Credential
$username = $creds.GetNetworkCredential().UserName
$password = $creds.GetNetworkCredential().Password
$proxyServer = "https://local/proxy/server"
$webProxy = New-Object System.Net.WebProxy($proxyServer,$true)
$webclient = new-object System.Net.WebClient
$creds = Get-Credential
$webclient.Proxy=$webproxy
$webclient.Proxy.Credentials = $creds
$env:chocolateyProxyLocation = $proxyServer
$env:chocolateyProxyUser = $username
$env:chocolateyProxyPassword = $password
$env:https_proxy = "https://${username}:${password}@${$proxyServer}"
# Set directory for installation - Chocolatey does not lock
# down the directory if not the default
$InstallDir='$env:LOCALAPPDATA\chocoportable'
$env:ChocolateyInstall="$InstallDir"
# set proxy info in user environment
[Environment]::SetEnvironmentVariable("chocolateyProxyLocation", $proxyServer, "User")
[Environment]::SetEnvironmentVariable("chocolateyProxyUser", $username, "User")
[Environment]::SetEnvironmentVariable("chocolateyProxyPassword", $password, "User")
[Environment]::SetEnvironmentVariable("ChocolateyInstall", $InstallDir, "User")
[Environment]::SetEnvironmentVariable("PATH", "%ChocolateyInstall%\bin;"+$env:Path, "User")
# If your PowerShell Execution policy is restrictive, you may
# not be able to get around that. Try setting your session to
# Bypass.
Set-ExecutionPolicy Bypass
# All install options - offline, proxy, etc at
# https://chocolatey.org/install
iex ($webclient.DownloadString('https://chocolatey.org/install.ps1'))
# PowerShell 3+?
#iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
choco install git.commandline -y
# pick an editor
#choco install visualstudiocode.portable -y # not yet available
#choco install nano -y
#choco install vim-tux.portable
# What else can I install without admin rights?
# https://chocolatey.org/packages?q=id%3Aportable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment