Raja's Exocortex

01-choco-install-desktop

Install Chocolatey using cmd.exe and optionally use an authenticated HTTP proxy if required.

Chocolatey Install Without Proxy (Direct Internet Connection)

@rem Filename: c:\apps\01-choco-install-desktop.bat
@rem Install chocolatey for desktop
@rem Optionally use a proxy server for downloading choco libraries and applications

@echo Installing chocolatey

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

@rem Disable confirmation before installing packages
choco feature enable -n=allowGlobalConfirmation

Chocolatey Install With Proxy (Restricted Internet Through Proxy)

@rem Filename: c:\apps\01-choco-install-desktop.bat
@rem Install chocolatey for desktop
@rem Optionally use a proxy server for downloading choco libraries and applications

@rem change: CHOCO_USER, CHOCO_PASS
@rem change: PROXY_URL (eg. choco-proxy.domain.com:3128)

@echo Installing chocolatey

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; $ENV:HTTPS_PROXY='http://CHOCO_USER:CHOCO_PASS@PROXY_URL:3128'; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

@rem Disable confirmation before installing packages
choco feature enable -n=allowGlobalConfirmation

@rem Configure http proxy installing other applications
@choco config set proxy http://PROXY_URL
@choco config set proxyUser CHOCO_USER
@choco config set proxyPassword CHOCO_PASS

References

  1. 02-choco-install-base
  2. 03-choco-upgrade