2023-11-16 11:20:11 +01:00
|
|
|
################################################################################
|
|
|
|
|
## File: Install-Chocolatey.ps1
|
|
|
|
|
## Desc: Install Chocolatey package manager
|
|
|
|
|
################################################################################
|
|
|
|
|
|
2021-07-29 10:46:27 +03:00
|
|
|
Write-Host "Set TLS1.2"
|
|
|
|
|
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
|
|
|
|
|
|
|
|
|
|
Write-Host "Install chocolatey"
|
|
|
|
|
|
|
|
|
|
# Add to system PATH
|
2023-12-04 10:50:53 +01:00
|
|
|
Add-MachinePathItem 'C:\ProgramData\Chocolatey\bin'
|
|
|
|
|
Update-Environment
|
2021-07-29 10:46:27 +03:00
|
|
|
|
2023-10-11 11:02:59 +02:00
|
|
|
# Verify and run choco installer
|
2023-12-11 22:23:36 +01:00
|
|
|
$installScriptPath = Invoke-DownloadWithRetry 'https://chocolatey.org/install.ps1'
|
2025-06-30 21:33:57 -04:00
|
|
|
Test-FileSignature -Path $installScriptPath -ExpectedSubject 'CN="Chocolatey Software, Inc", O="Chocolatey Software, Inc", L=Topeka, S=Kansas, C=US'
|
2023-12-11 22:23:36 +01:00
|
|
|
Invoke-Expression $installScriptPath
|
2021-07-29 10:46:27 +03:00
|
|
|
|
|
|
|
|
# Turn off confirmation
|
|
|
|
|
choco feature enable -n allowGlobalConfirmation
|
|
|
|
|
|
|
|
|
|
# Initialize environmental variable ChocolateyToolsLocation by invoking choco Get-ToolsLocation function
|
|
|
|
|
Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" -Force
|
2022-03-24 19:09:18 +01:00
|
|
|
Get-ToolsLocation
|