Created
August 23, 2017 01:17
-
-
Save tom-henderson/a2435e7860506e810e87e1e6131bfc75 to your computer and use it in GitHub Desktop.
Get pending windows updates.
This file contains hidden or 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
function Get-AvailableUpdates { | |
[CmdletBinding()] | |
Param() | |
$wu_session = New-Object -ComObject Microsoft.Update.Session | |
$wu_searcher = $wu_session.CreateUpdateSearcher() | |
$updates = $wu_searcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0") | |
return $updates.Updates ` | |
| Select Title, RebootRequired, IsInstalled, IsDownloaded, IsHidden, IsPresent, ` | |
@{Name='KbArticleIds';Expression={$_.KbArticleIds}}, ` | |
@{Name='CveIds';Expression={$_.CveIds}}, ` | |
@{Name='Size (MB)';Expression={[math]::truncate($_.MaxDownloadSize / 1MB)}} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment