1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
if (!$wsus) {
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();
}
$updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope;
$updateScope.UpdateApprovalActions = [Microsoft.UpdateServices.Administration.UpdateApprovalActions]::Install
$computerScope = new-object Microsoft.UpdateServices.Administration.ComputerTargetScope;
[DateTime]::UtcNow.ToShortDateString()
$wsus.GetUpdates($updateScope) | where { ( $_.'Title' -like '*2008 R2*' ) -and ( $_.'Title' -like '*7*') -and -not ( $_.'Title' -like '*Itanium*' )} | foreach {
$update = $_
"Update " + $update.KnowledgebaseArticles+","+$update.MsrcSeverity
$summary = $wsus.GetSummariesPerUpdate($updateScope, $computerScope);
$neededCount = ($summary.InstalledPendingRebootCount + $summary.NotInstalledCount)
"`t Installed: " + ($Summary.InstalledCount + $summary.NotApplicableCount)+","+
"`t Needed: " + $neededCount+","+
"`t Failed: " + $summary.FailedCount+","+
"`t Unknown: " + $summary.UnknownCount;
} |
Partager