Files
winutil/functions/private/Install-WinUtilChoco.ps1
T

30 lines
882 B
PowerShell
Raw Normal View History

+3
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
+3
2023-03-07 12:28:00 -08:00
#>
2023-10-19 17:12:55 -05:00
try {
+3
2023-03-07 12:28:00 -08:00
Write-Host "Checking if Chocolatey is Installed..."
2024-02-07 18:11:40 -06:00
if((Get-Command -Name choco -ErrorAction Ignore)) {
+3
2023-03-07 12:28:00 -08:00
Write-Host "Chocolatey Already Installed"
return
}
2023-10-19 17:12:55 -05:00
Write-Host "Seems Chocolatey is not installed, installing now"
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
powershell choco feature enable -n allowGlobalConfirmation
+3
2023-03-07 12:28:00 -08:00
}
2023-10-19 17:12:55 -05:00
Catch {
Write-Host "==========================================="
Write-Host "-- Chocolatey failed to install ---"
Write-Host "==========================================="
+3
2023-03-07 12:28:00 -08:00
}
}