I am trying to create a collection/query in which I would detect the devices which have a pending reboot. I am using the following code obtained from the internet.
SELECT SMS_R_SYSTEM.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client FROM sms_r_system inner join SMS_UpdateComplianceStatus ON SMS_UpdateComplianceStatus.machineid=sms_r_system.resourceid WHERE SMS_UpdateComplianceStatus.LastEnforcementMessageID = 9
It seems to work, but....I also noticed some clients which do not have a reboot pending and still have in SCCM the LastEnforcementMessageID set to 9.
Does someone have the same behavior and knows how to fix this ?
Also I see in my query that this specific client reports LastEnforcementMessageID <null>, 9 and 10 at the same time.