2023-03-07 12:28:00 -08:00
|
|
|
function Install-WinUtilChoco {
|
|
|
|
|
|
|
|
|
|
<#
|
2023-10-19 17:12:55 -05:00
|
|
|
|
|
|
|
|
.SYNOPSIS
|
|
|
|
|
Installs Chocolatey if it is not already installed
|
|
|
|
|
|
2023-03-07 12:28:00 -08:00
|
|
|
#>
|
|
|
|
|
|
2023-10-19 17:12:55 -05:00
|
|
|
try {
|
2023-03-07 12:28:00 -08:00
|
|
|
Write-Host "Checking if Chocolatey is Installed..."
|
|
|
|
|
|
2024-03-30 11:46:29 -05:00
|
|
|
if((Test-WinUtilPackageManager -choco) -eq "installed") {
|
2023-03-07 12:28:00 -08:00
|
|
|
return
|
|
|
|
|
}
|
2024-09-12 16:45:54 +02:00
|
|
|
# Install logic taken from https://chocolatey.org/install#individual
|
2024-03-30 11:46:29 -05:00
|
|
|
Write-Host "Seems Chocolatey is not installed, installing now."
|
2024-09-12 09:49:06 -05:00
|
|
|
Set-ExecutionPolicy Bypass -Scope Process -Force;
|
|
|
|
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
|
2024-09-12 16:45:54 +02:00
|
|
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
2023-10-19 17:12:55 -05:00
|
|
|
|
2024-08-06 23:35:17 +03:00
|
|
|
} catch {
|
2024-03-30 11:46:29 -05:00
|
|
|
Write-Host "===========================================" -Foregroundcolor Red
|
|
|
|
|
Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red
|
|
|
|
|
Write-Host "===========================================" -Foregroundcolor Red
|
2023-03-07 12:28:00 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|