mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-06-04 14:17:27 +00:00
Compare commits
1 Commits
26.04.30
...
a3f57532b6
| Author | SHA1 | Date | |
|---|---|---|---|
| a3f57532b6 |
@@ -1,24 +0,0 @@
|
||||
function Get-WinUtilInstallerProcess {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Checks if the given process is running
|
||||
|
||||
.PARAMETER Process
|
||||
The process to check
|
||||
|
||||
.OUTPUTS
|
||||
Boolean - True if the process is running
|
||||
|
||||
#>
|
||||
|
||||
param($Process)
|
||||
|
||||
if ($Null -eq $Process) {
|
||||
return $false
|
||||
}
|
||||
if (Get-Process -Id $Process.Id -ErrorAction SilentlyContinue) {
|
||||
return $true
|
||||
}
|
||||
return $false
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
Function Update-WinUtilProgramWinget {
|
||||
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
This will update all programs using WinGet
|
||||
|
||||
#>
|
||||
|
||||
[ScriptBlock]$wingetinstall = {
|
||||
|
||||
$host.ui.RawUI.WindowTitle = """WinGet Install"""
|
||||
|
||||
Start-Transcript "$logdir\winget-update_$dateTime.log" -Append
|
||||
winget upgrade --all --accept-source-agreements --accept-package-agreements --scope=machine --silent
|
||||
|
||||
}
|
||||
|
||||
$global:WinGetInstall = Start-Process -Verb runas powershell -ArgumentList "-command invoke-command -scriptblock {$wingetinstall} -argumentlist '$($ProgramsToInstall -join ",")'" -PassThru
|
||||
|
||||
}
|
||||
@@ -1,36 +1,21 @@
|
||||
function Invoke-WPFInstallUpgrade {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Invokes the function that upgrades all installed programs
|
||||
|
||||
#>
|
||||
if ($sync.ChocoRadioButton.IsChecked) {
|
||||
Install-WinUtilChoco
|
||||
$chocoUpgradeStatus = (Start-Process "choco" -ArgumentList "upgrade all -y" -Wait -PassThru -NoNewWindow).ExitCode
|
||||
if ($chocoUpgradeStatus -eq 0) {
|
||||
Write-Host "Upgrade Successful"
|
||||
}
|
||||
else{
|
||||
Write-Host "Error Occurred. Return Code: $chocoUpgradeStatus"
|
||||
}
|
||||
}
|
||||
else{
|
||||
if((Test-WinUtilPackageManager -winget) -eq "not-installed") {
|
||||
return
|
||||
}
|
||||
|
||||
if(Get-WinUtilInstallerProcess -Process $global:WinGetInstall) {
|
||||
$msg = "[Invoke-WPFInstallUpgrade] Install process is currently running. Please check for a powershell window labeled 'Winget Install'"
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
|
||||
Update-WinUtilProgramWinget
|
||||
Install-WinUtilChoco # Ensure Chocolatey is installed before upgrading
|
||||
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Updates started ---"
|
||||
Write-Host "-- You can close this window if desired ---"
|
||||
Write-Host "==========================================="
|
||||
|
||||
Start-Process -FilePath powershell.exe -ArgumentList 'choco upgrade all -y'
|
||||
} else {
|
||||
Install-WinUtilWinget # Ensure WinGet is installed before upgrading
|
||||
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Updates started ---"
|
||||
Write-Host "-- You can close this window if desired ---"
|
||||
Write-Host "==========================================="
|
||||
|
||||
Start-Process -FilePath powershell.exe -ArgumentList 'winget upgrade --all --include-unknown --silent --accept-source-agreements --accept-package-agreements'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user