mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-29 01:11:30 -06:00
29 lines
1.0 KiB
PowerShell
29 lines
1.0 KiB
PowerShell
function Install-WinUtilChoco {
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Installs Chocolatey if it is not already installed
|
|
|
|
#>
|
|
|
|
try {
|
|
Write-Host "Checking if Chocolatey is Installed..."
|
|
|
|
if((Test-WinUtilPackageManager -choco) -eq "installed") {
|
|
return
|
|
}
|
|
# Install logic taken from https://chocolatey.org/install#individual
|
|
Write-Host "Seems Chocolatey is not installed, installing now."
|
|
Set-ExecutionPolicy Bypass -Scope Process -Force;
|
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
|
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
|
|
|
} catch {
|
|
Write-Host "===========================================" -Foregroundcolor Red
|
|
Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red
|
|
Write-Host "===========================================" -Foregroundcolor Red
|
|
}
|
|
|
|
}
|