Trevor Sullivan's Tech Room

Minding the gap between administration and development

PowerShell / ConfigMgr 2012: Check Client Reboot Pending State

Posted by Trevor Sullivan on 2011/07/25


If you’ve worked with Configuration Manager 2007 for very long, you probably know that clients pending reboots can cause you quite a headache. Determining whether or not a client needs a reboot can be a challenging task, and most folks used desired configuration management rules to detect it.

Well, I’m happy to announce that there’s a new method of figuring out whether or not a SCCM client requires a reboot! There’s a new WMI namespace called root\ccm\ClientSDK, and within it is a WMI class called CCM_ClientUtilities, which has a static method called DetermineIfRebootPending() – the method does not take any input parameters, however it spits out several [out] parameters when it is called.



Output Parameters



The DetermineIfRebootPending() method can be easily called from Windows PowerShell, which tightly integrates with WMI (Windows Management Instrumentation). It’s a very simple, two-step process:

  1. Get a reference to the CCM_ClientUtilities WMI class
  2. Call the DetermineIfRebootPending() method

Here is what the code would look like:

PS C:\Users\ts> $clientutils = [wmiclass]"root\ccm\clientsdk:CCM_ClientUtilities"
PS C:\Users\ts> $clientutils.DetermineIfRebootPending()

__GENUS             : 1
__CLASS             : __PARAMETERS
__SUPERCLASS        :
__DYNASTY           : __PARAMETERS
__RELPATH           : __PARAMETERS
__DERIVATION        : {}
__SERVER            : SCCM02
__NAMESPACE         : ROOT\ccm\ClientSDK
__PATH              : \\SCCM02\ROOT\ccm\ClientSDK:__PARAMETERS
DisableHideTime     : 19691231180000.000000+000
InGracePeriod       : False
IsHardRebootPending : False
RebootDeadline      : 19691231180000.000000+000
RebootPending       : False
ReturnValue         : 0

As you can see, we get several useful properties returned to us, specifically the IsHardRebootPending and RebootPending.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: