diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index a17a517e..09baddc6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -7,10 +7,10 @@ body: attributes: value: | # 🐞 **Issue Report** - Thank you for taking the time to report an issue! Please provide as much detail as possible to help us address the problem efficiently. + Thank you for taking the time to report an issue! Please provide as much detail as possible to help us address the problem efficiently. - ## ⚠️ **IMPORTANT** - - 🛠️ **Supported environments only:** We only support Windows 11. Custom ISOs that are not made using Microwin are not supported. + ## ⚠️ **IMPORTANT** + - 🛠️ **Supported environments only:** We only support Windows 11. Custom ISOs that are not made using Microwin are not supported. - 💡 For general questions, use the [Discussions section](https://github.com/Christitustech/winutil/discussions) or join our Community-driven [Discord Server](https://discord.gg/RUbZUZyByQ). - type: checkboxes diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index d32fae1e..65e24338 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -9,7 +9,7 @@ body: # ✨ **Feature request** Thank you for taking the time to suggest a feature! Please provide as much detail as possible to help us understand and evaluate your request. - ## ⚠️ **IMPORTANT** + ## ⚠️ **IMPORTANT** - 🛠️ **Supported environments only:** We only support Windows 11. - 💡 For general questions, use the [Discussions section](https://github.com/Christitustech/winutil/discussions) or join our Community-driven [Discord Server](https://discord.gg/RUbZUZyByQ). @@ -54,4 +54,4 @@ body: label: 🖼️ Additional context placeholder: "Include screenshots, code blocks (use triple backticks ```), or any other relevant information." validations: - required: false \ No newline at end of file + required: false diff --git a/functions/public/Invoke-WPFButton.ps1 b/functions/public/Invoke-WPFButton.ps1 index f2e528fb..ae9b753e 100644 --- a/functions/public/Invoke-WPFButton.ps1 +++ b/functions/public/Invoke-WPFButton.ps1 @@ -61,6 +61,10 @@ function Invoke-WPFButton { "WPFWinUtilInstallPSProfile" {Invoke-WinUtilInstallPSProfile} "WPFWinUtilUninstallPSProfile" {Invoke-WinUtilUninstallPSProfile} "WPFWinUtilSSHServer" {Invoke-WPFSSHServer} - "WPFScanUpdates" {Invoke-WPFScanUpdates} + "WPFScanUpdates" {Invoke-WPFUpdatesScan} + "WPFShowUpdateHistory" { Invoke-WPFUpdateHistoryToggle } + "WPFUpdateSelectedInstall" {Invoke-WPFUpdateMGMT -Selected} + "WPFUpdateAllInstall" {Invoke-WPFUpdateMGMT -All} + "WPFUpdateScanHistory" {Invoke-WPFUpdateScanHistory} } } diff --git a/functions/public/Invoke-WPFUpdateHistoryToggle.ps1 b/functions/public/Invoke-WPFUpdateHistoryToggle.ps1 new file mode 100644 index 00000000..030b6be1 --- /dev/null +++ b/functions/public/Invoke-WPFUpdateHistoryToggle.ps1 @@ -0,0 +1,11 @@ +function Invoke-WPFUpdateHistoryToggle { + if ($sync["WPFShowUpdateHistory"].Content -eq "Show History") { + $sync["WPFShowUpdateHistory"].Content = "Show available Updates" + $sync["HistoryGrid"].Visibility = "Visible" + $sync["UpdatesGrid"].Visibility = "Collapsed" + } else { + $sync["WPFShowUpdateHistory"].Content = "Show History" + $sync["HistoryGrid"].Visibility = "Collapsed" + $sync["UpdatesGrid"].Visibility = "Visible" + } +} diff --git a/functions/public/Invoke-WPFUpdateMGMGT.ps1 b/functions/public/Invoke-WPFUpdateMGMGT.ps1 new file mode 100644 index 00000000..bb7e7233 --- /dev/null +++ b/functions/public/Invoke-WPFUpdateMGMGT.ps1 @@ -0,0 +1,13 @@ +function Invoke-WPFUpdateMGMT { + param ( + [switch]$Selected, + [switch]$All + ) + + if ($Selected) { + write-host "Installing selected updates" + } elseif ($All) { + Write-Host "Installing all available updates" + } + +} diff --git a/functions/public/Invoke-WPFUpdateScanHistory.ps1 b/functions/public/Invoke-WPFUpdateScanHistory.ps1 new file mode 100644 index 00000000..4138e746 --- /dev/null +++ b/functions/public/Invoke-WPFUpdateScanHistory.ps1 @@ -0,0 +1,46 @@ +function Invoke-WPFUpdateScanHistory { + $sync["WPFUpdateHistory"].Items.Clear() + Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock { + write-host "Scanning for Windows update history..." + $UpdateHistory = Get-WUHistory -Last 50 -ErrorAction SilentlyContinue + if ($UpdateHistory) { + foreach ($update in $UpdateHistory) { + $item = New-Object PSObject -Property @{ + ComputerName = $update.ComputerName + Result = $update.Result + Title = $update.Title -replace '\s*\(KB\d+\)', '' -replace '\s*KB\d+\b', '' # Remove KB number from title, first in parentheses, then standalone + KB = $update.KB + Date = $update.Date + } + $Computers = $item | Select-Object -ExpandProperty ComputerName -Unique + $sync.form.Dispatcher.Invoke([action] { + $sync["WPFUpdateHistory"].Items.Add($item) + if ($item.Result -eq "Succeeded") { + # does not work : $sync["WPFUpdateHistory"].Items[$sync["WPFUpdateHistory"].Items.Count - 1].Foreground = "Green" + #write-host "$($item.Title) was successful" + } + elseif ($item.Result -eq "Failed") { + # does not work : $sync["WPFUpdateHistory"].Items[$sync["WPFUpdateHistory"].Items.Count - 1].Foreground = "Red" + #write-host "$($item.Title) failed" + } + }) + } + write-host "Found $($UpdateHistory.Count) updates." + $sync.form.Dispatcher.Invoke([action] { + if ($Computers.Count -gt 1) { + $sync["WPFUpdateHistory"].Columns[0].Visibility = "Visible" + } + else { + Write-Debug "Hiding ComputerName column, only $item.ComputerName" + $sync["WPFUpdateHistory"].Columns[0].Visibility = "Collapsed" + } + }) + } + else { + $sync.form.Dispatcher.Invoke([action] { + $sync["WPFUpdateHistory"].Items.Clear() + }) + Write-Host "No update history available." + } + } +} diff --git a/functions/public/Invoke-WPFScanUpdates.ps1 b/functions/public/Invoke-WPFUpdatesScan.ps1 similarity index 78% rename from functions/public/Invoke-WPFScanUpdates.ps1 rename to functions/public/Invoke-WPFUpdatesScan.ps1 index cb41532c..deab6b1a 100644 --- a/functions/public/Invoke-WPFScanUpdates.ps1 +++ b/functions/public/Invoke-WPFUpdatesScan.ps1 @@ -1,4 +1,4 @@ -function Invoke-WPFScanUpdates { +function Invoke-WPFUpdatesScan { Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock { @@ -26,7 +26,6 @@ function Invoke-WPFScanUpdates { } try { - Write-Host "Clearing updates list..." $sync.form.Dispatcher.Invoke([action] { $sync["WPFUpdatesList"].Items.Clear() }) Write-Host "Scanning for Windows updates..." $updates = Get-WindowsUpdate -ErrorAction Stop @@ -35,13 +34,21 @@ function Invoke-WPFScanUpdates { $sync.form.Dispatcher.Invoke([action] { foreach ($update in $updates) { $item = New-Object PSObject -Property @{ + ComputerName = $update.ComputerName KB = $update.KB Size = $update.Size Title = $update.Title -replace '\s*\(KB\d+\)', '' -replace '\s*KB\d+\b', '' # Remove KB number from title, first in parentheses, then standalone Status = "Not Installed" } + $Computers = $item | Select-Object -ExpandProperty ComputerName -Unique $sync["WPFUpdatesList"].Items.Add($item) } + if ($Computers.Count -gt 1) { + $sync["WPFUpdatesList"].Columns[0].Visibility = "Visible" + } else { + Write-Debug "Hiding ComputerName column, only $item.ComputerName" + $sync["WPFUpdatesList"].Columns[0].Visibility = "Collapsed" + } }) } catch { Write-Error "Error scanning for updates: $_" diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml index b2518869..f4ab03cb 100644 --- a/xaml/inputXML.xaml +++ b/xaml/inputXML.xaml @@ -1308,7 +1308,7 @@ - + @@ -1352,51 +1352,163 @@ - -