forked from ChrisTitusTech/winutil
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add Computername into DataGrid (if needed) - add toggle for Update History - add Update History interface - add Update Interface Toggle Logic - add Update scan logic - initialize Update selected / all logic - center specific datagrid columns
- Loading branch information
1 parent
eea96f5
commit e830ff0
Showing
8 changed files
with
240 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.