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.
- move update presets to smaller collumn - add new collumn for windows update manager - add datagrid - add datagrid style
- Loading branch information
1 parent
8a0e0c7
commit eea96f5
Showing
3 changed files
with
307 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
function Invoke-WPFScanUpdates { | ||
|
||
|
||
Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock { | ||
# Check if the PSWindowsUpdate module is installed | ||
if (-not (Get-Module -ListAvailable -Name PSWindowsUpdate)) { | ||
try { | ||
Write-Host "PSWindowsUpdate module not found. Attempting to install..." | ||
Install-Module -Name PSWindowsUpdate -Force -Scope CurrentUser | ||
Write-Host "PSWindowsUpdate module installed successfully." | ||
} | ||
catch { | ||
Write-Error "Failed to install PSWindowsUpdate module: $_" | ||
return | ||
} | ||
} | ||
|
||
# Import the module | ||
try { | ||
Import-Module PSWindowsUpdate -ErrorAction Stop | ||
Write-Host "PSWindowsUpdate module imported successfully." | ||
} | ||
catch { | ||
Write-Error "Failed to import PSWindowsUpdate module: $_" | ||
return | ||
} | ||
|
||
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 | ||
Write-Host "Found $($updates.Count) updates." | ||
|
||
$sync.form.Dispatcher.Invoke([action] { | ||
foreach ($update in $updates) { | ||
$item = New-Object PSObject -Property @{ | ||
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" | ||
} | ||
$sync["WPFUpdatesList"].Items.Add($item) | ||
} | ||
}) | ||
} catch { | ||
Write-Error "Error scanning for updates: $_" | ||
} | ||
} | ||
} |
Oops, something went wrong.