mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-16 01:40:35 -06:00
a86b07a826
https://learn.microsoft.com/en-us/dotnet/api/system.windows.shell.taskbariteminfo?view=windowsdesktop-8.0
33 lines
1.1 KiB
PowerShell
33 lines
1.1 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
|
|
}
|
|
|
|
$sync["Form"].taskbarItemInfo.ProgressState = "Indeterminate"
|
|
|
|
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
|
|
$sync["Form"].taskbarItemInfo.ProgressState = "None"
|
|
|
|
}
|
|
Catch {
|
|
Write-Host "===========================================" -Foregroundcolor Red
|
|
Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red
|
|
Write-Host "===========================================" -Foregroundcolor Red
|
|
$sync["Form"].taskbarItemInfo.ProgressState = "Error"
|
|
}
|
|
|
|
}
|