3

How can i get all patches that require a reboot before running the install process using WMI and SCCM. So far i have this wmi query that lists all the available patches but none of the properties returned indicate anything about patches being required or not.

function Get-CMMissingUpdate {
param (
$computer = "localhost"
)
    Get-WmiObject -Query "SELECT * FROM CCM_SoftwareUpdate" -Namespace "ROOT\ccm\ClientSDK" -ComputerName $computer
}

Has anyone used anything else to find this information from SCCM 2012 ?

Warz
  • 235
  • 1
  • 3
  • 7

1 Answers1

3

You want to filter on the EvaluationState property of the updates that are returned. There are several types of Evaluation States for pending reboots, they are listed on the technet page for the sccm client sdk. States 8,9, & 10 are for pending reboots. Looking at your function, I would do something like

function Get-CMMissingUpdate {
param (
$computer = "localhost"
)
    Get-WmiObject -Query "SELECT * FROM CCM_SoftwareUpdate WHERE EVALUATIONSTATE = 8 OR EVALUATIONSTATE = 9 OR EVALUATIONSTATE = 10" -Namespace "ROOT\ccm\ClientSDK" -ComputerName $computer
}

If you're going to feed raw syntax instead of using powershell, whatever floats your boat. I don't have any pending sccm updates right now, or time to rig up a test box, but this should get you going.

MDMoore313
  • 5,531
  • 6
  • 34
  • 73
  • The evaluation state will change to those states you have mentioned only after an `installUpdates` has been issued. I am looking to find out which updates require a reboot before installing them. – Warz Jan 09 '14 at 15:20
  • You can't know that, because the only language MS gives in their bulletins is that an update *may be required*. This is because it's impossible to know what files will be in use when the updates are being installed. – MDMoore313 Jan 09 '14 at 16:12
  • Okay thanks, i was able to use your evaluation state to get me what i needed. – Warz Jan 09 '14 at 22:12