mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 06:35:51 -06:00
30 lines
882 B
PowerShell
30 lines
882 B
PowerShell
function Install-WinUtilChoco {
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Installs Chocolatey if it is not already installed
|
|
|
|
#>
|
|
|
|
try {
|
|
Write-Host "Checking if Chocolatey is Installed..."
|
|
|
|
if((Get-Command -Name choco -ErrorAction Ignore)) {
|
|
Write-Host "Chocolatey Already Installed"
|
|
return
|
|
}
|
|
|
|
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
|
|
|
|
}
|
|
Catch {
|
|
Write-Host "==========================================="
|
|
Write-Host "-- Chocolatey failed to install ---"
|
|
Write-Host "==========================================="
|
|
}
|
|
|
|
}
|