Sometimes you might find yourself in a rare situation when you have an urgent need to immediately patch the computer with an SCCM agent on it, but Software Center refuses to cooperate - it throws errors and does nt open despite several troubleshooting attempts including re-installation of the agent. In this case the following commands might come in handy:
Usage:
The following cmd command will help you to "see" the actionable patches list as displayed in the Software Center. The exemplary output of the comment is below:
ArticleID=4055532
EvaluationState=6
Name=2018-01 Security and Quality Rollup for .NET Framework 3.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1 on Windows 7 and Server 2008 R2 for x64 (KB4055532)
ArticleID=890830
EvaluationState=6
Name=Windows Malicious Software Removal Tool x64 - February 2018 (KB890830)
ArticleID=4076492
EvaluationState=8
Name=2018-02 Security and Quality Rollup for .NET Framework 3.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1 on Windows 7 and Server 2008 R2 for x64 (KB4076492)
ArticleID=4055269
EvaluationState=6
Name=2018-01 Security Only Update for .NET Framework 3.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1 on Windows 7 and Server 2008 R2 for x64 (KB4055269)
Below you can find a reference for available Evalutaion state (source: CCM_SoftwareUpdate Client WMI Class)
Value State
0 ciJobStateNone
1 ciJobStateAvailable
2 ciJobStateSubmitted
3 ciJobStateDetecting
4 ciJobStatePreDownload
5 ciJobStateDownloading
6 ciJobStateWaitInstall
7 ciJobStateInstalling
8 ciJobStatePendingSoftReboot
9 ciJobStatePendingHardReboot
10 ciJobStateWaitReboot
11 ciJobStateVerifying
12 ciJobStateInstallComplete
13 ciJobStateError
14 ciJobStateWaitServiceWindow
15 ciJobStateWaitUserLogon
16 ciJobStateWaitUserLogoff
17 ciJobStateWaitJobUserLogon
18 ciJobStateWaitUserReconnect
19 ciJobStatePendingUserLogoff
20 ciJobStatePendingUpdate
21 ciJobStateWaitingRetry
22 ciJobStateWaitPresModeOff
23 ciJobStateWaitForOrchestration
Code:
wmic /namespace:\\root\ccm\
Usage:
The following cmdlets will force the installation of all actionable updates
Code:
$MissingUpdates = Get-WmiObject -Class CCM_SoftwareUpdate -Filter ComplianceState=0 -Namespace root\CCM\ClientSDK
$MissingUpdatesReformatted = @($MissingUpdates | ForEach-Object {IF($_.ComplianceState -eq 0){[WMI]$_.__PATH}})
$InstallReturn = Invoke-WmiMethod -Class CCM_SoftwareUpdatesManager -Name InstallUpdates -ArgumentList (,$MissingUpdatesReformatted) -Namespace root\ccm\ClientSDK