Write-Host "Set TLS1.2" [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" Write-Host "Install chocolatey" $chocoExePath = 'C:\ProgramData\Chocolatey\bin' # Add to system PATH $systemPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) $systemPath += ';' + $chocoExePath [Environment]::SetEnvironmentVariable("PATH", $systemPath, [System.EnvironmentVariableTarget]::Machine) # Update local process' path $userPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::User) if ($userPath) { $env:Path = $systemPath + ";" + $userPath } else { $env:Path = $systemPath } # Run the installer Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) # Turn off confirmation choco feature enable -n allowGlobalConfirmation # https://github.com/chocolatey/choco/issues/89 # Remove some of the command aliases, like `cpack` #89 Remove-Item -Path $env:ChocolateyInstall\bin\cpack.exe -Force # Initialize environmental variable ChocolateyToolsLocation by invoking choco Get-ToolsLocation function Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" -Force Get-ToolsLocation