Fixing an issue related to winget install & Improving winget uninstall command (#1662)

* Add the argument '--accept-source-agreements' to the Uninstall command of Winget

Added '--accept-source-agreements' to insure that the Package Uninstall process is completely unattended.

* Improve the Wording of the 'WPFInstall' function and 'inputXML.xaml' file
This commit is contained in:
Mr.k 2024-03-22 02:00:07 +03:00 committed by GitHub
parent 1337ac4359
commit 14d6d07dc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 8 deletions

View File

@ -33,12 +33,12 @@ Function Install-WinUtilProgramWinget {
Start-Process -FilePath winget -ArgumentList "install -e --accept-source-agreements --accept-package-agreements --scope=machine --silent $Program" -NoNewWindow -Wait Start-Process -FilePath winget -ArgumentList "install -e --accept-source-agreements --accept-package-agreements --scope=machine --silent $Program" -NoNewWindow -Wait
} }
if($manage -eq "Uninstalling"){ if($manage -eq "Uninstalling"){
Start-Process -FilePath winget -ArgumentList "uninstall -e --purge --force --silent $Program" -NoNewWindow -Wait Start-Process -FilePath winget -ArgumentList "uninstall -e --accept-source-agreements --purge --force --silent $Program" -NoNewWindow -Wait
} }
$X++ $X++
} }
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
} }

View File

@ -2,12 +2,12 @@ function Invoke-WPFInstall {
<# <#
.SYNOPSIS .SYNOPSIS
Installs the selected programs using winget Installs the selected programs using winget, if one or more of the selected programs are already installed on the system, winget will try and perform an upgrade if there's a newer version to install.
#> #>
if($sync.ProcessRunning){ if($sync.ProcessRunning){
$msg = "[Invoke-WPFInstall] Install process is currently running." $msg = "[Invoke-WPFInstall] An Install process is currently running."
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning) [System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
return return
} }
@ -15,7 +15,7 @@ function Invoke-WPFInstall {
$WingetInstall = (Get-WinUtilCheckBoxes)["Install"] $WingetInstall = (Get-WinUtilCheckBoxes)["Install"]
if ($wingetinstall.Count -eq 0) { if ($wingetinstall.Count -eq 0) {
$WarningMsg = "Please select the program(s) to install" $WarningMsg = "Please select the program(s) to install or upgrade"
[System.Windows.MessageBox]::Show($WarningMsg, $AppTitle, [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning) [System.Windows.MessageBox]::Show($WarningMsg, $AppTitle, [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
return return
} }
@ -41,4 +41,4 @@ function Invoke-WPFInstall {
Start-Sleep -Seconds 5 Start-Sleep -Seconds 5
$sync.ProcessRunning = $False $sync.ProcessRunning = $False
} }
} }

View File

@ -690,7 +690,7 @@
<RowDefinition Height="0.95*"/> <RowDefinition Height="0.95*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Background="{MainBackgroundColor}" Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="0" Grid.ColumnSpan="3" Margin="5"> <StackPanel Background="{MainBackgroundColor}" Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="0" Grid.ColumnSpan="3" Margin="5">
<Button Name="WPFinstall" Content=" Install Selected" Margin="2" /> <Button Name="WPFinstall" Content=" Install/Upgrade Selected" Margin="2" />
<Button Name="WPFInstallUpgrade" Content=" Upgrade All" Margin="2"/> <Button Name="WPFInstallUpgrade" Content=" Upgrade All" Margin="2"/>
<Button Name="WPFuninstall" Content=" Uninstall Selection" Margin="2"/> <Button Name="WPFuninstall" Content=" Uninstall Selection" Margin="2"/>
<Button Name="WPFGetInstalled" Content=" Get Installed" Margin="2"/> <Button Name="WPFGetInstalled" Content=" Get Installed" Margin="2"/>