$s_ComputerName = @ComputerName $s_WMIClass="CCM_ClientUtilities" $s_WMINameSpace="ROOT\ccm\ClientSDK" ;Adapted from Vb script procedure https://social.technet.microsoft.com/Forums/en-US/ed4e35c7-a1c9-43ea-ab82-970eadb4915e/ccmclientutilities-pending-boot-script-in-vbscript?forum=configmanagersdk $o_WMIService = ObjGet("winmgmts:\\" & $s_ComputerName & "\" & $s_WMINameSpace) If @error then ;Do nothing - WMI problem or namespace doesn't exist. ;There can't be an SCCM-pending reboot Else ;WMI connection completed $o_SMS = $o_WMIService.Get($s_WMIClass) If IsObj($o_SMS) Then $o_PendingBoot = $o_SMS.Methods_("DetermineIfRebootPending").InParameters ;Result of this is NOT an object If @error=0 Then $o_OutParams = $o_SMS.ExecMethod_("DetermineIfRebootPending", $o_PendingBoot) If IsObj($o_OutParams) Then ;We have data from SCCM regarding its reboot status Msgbox(64,"WMI Results", _ "DisableHideTime: " & WMIDateStringToDate($o_OutParams.DisableHideTime) & @CRLF & _ "InGracePeriod: " & $o_OutParams.InGracePeriod & @CRLF & _ "IsHardRebootPending: " & $o_OutParams.IsHardRebootPending & @CRLF & _ "NotifyUI: " & $o_OutParams.NotifyUI & @CRLF & _ "RebootDeadline: " & WMIDateStringToDate($o_OutParams.RebootDeadline) & @CRLF & _ "RebootPending: " & $o_OutParams.RebootPending & @CRLF & _ "ReturnValue: " & $o_OutParams.ReturnValue,"") ;Is a reboot pending? If $o_OutParams.IsHardRebootPending = True Or $o_OutParams.RebootPending=True Then ;Yes, reboot pending $i_SCCMRebootPend=1 EndIf Else ;Issue connecting to the object. ;Unable to determine if there is an SCCM-pending reboot EndIf Else ;Issue getting object data. ;Unable to determine if there is an SCCM-pending reboot EndIf Else ;Issue connecting to the object. ;Unable to determine if there is an SCCM-pending reboot EndIf ;Ensure objects are released $o_OutParams=0 $o_PendingBoot=0 $o_SMS=0 EndIf Func WMIDateStringToDate($dtmDate) #cs Extracted from Scriptomatic for Autoit output. Scriptomatic taken from: https://www.autoitscript.com/forum/files/file/338-scriptomatic-warraysupport/ #ce Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc