mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 14:45:52 -06:00
14d20cd161
* First Selector and Logic * Extend Functionality * Switch to PreferChocolatey Checkbox * Persist Choco Preference across program restarts * Change Logging, Fix interactivity and optimize uninstall * Implement "Get-Installed" (quick-and-dirty) * Code Formatting * Rename File/Function, Refactor Choco Install, Add Status Indicator * Add documentation --------- Co-authored-by: Chris Titus <contact@christitus.com>
28 lines
1.0 KiB
PowerShell
28 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
|
|
}
|
|
|
|
Write-Host "Seems Chocolatey is not installed, installing now."
|
|
Start-Process -FilePath "powershell" -ArgumentList "Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop" -Wait -NoNewWindow
|
|
Start-Process -FilePath "powershell" -ArgumentList "choco feature enable -n allowGlobalConfirmation" -Wait -NoNewWindow
|
|
|
|
} catch {
|
|
Write-Host "===========================================" -Foregroundcolor Red
|
|
Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red
|
|
Write-Host "===========================================" -Foregroundcolor Red
|
|
}
|
|
|
|
}
|