Understanding and using the Pending Restart Feature in SCCM Current Branch


I get queried a lot on new features in System Center Configuration Management and how they can be used to simplify life for customers, on a daily basis.

Microsoft's mission is to empower every person and every organization on the planet to achieve more, so how can ConfigMgr help with that?

 

With the release of ConfigMgr 1710 a new feature was added called “Pending Restart”

This has allowed Administrators to quickly, out of the console identify what machines need a restart and what is the reason for requiring a restart.

 

This blog post is going to guide you through how we can use the WQL and SQL Queries to create reports and collections to simplify the management and reporting to business, as well as using this to schedule your mass restarts to ensure that your devices remain compliant.

So… Let’s get started!

 

ClientState

 

Firstly we need to understand that when we are looking at the "Pending Restart" Tab in a Collection, that it uses the ClientState Information in the v_CombinedDeviceResources view, in the Database

 

Screen1

 

The ClientState information is what lets us know if there is a reboot pending.

There are five main states:

0 = No reboot Pending
1 = Configuration Manager
2 = File Rename
4 = Windows Update
8 = Add or Remove Feature

A computer may have more than one of the states applying at the same time, which will change the state number to a combination of the applicable states.

1 – Configuration Manager
2 – File Rename
3 – Configuration Manager, File Rename
4 – Windows Update
5 – Configuration Manager, Windows Update
6 – File Rename, Windows Update
7 – Configuration Manager, File Rename, Windows Update
8 – Add or Remove Feature
9 – Configuration Manager, Add or Remove Feature
10 – File Rename, Add or Remove Feature
11 – Configuration Manager, File Rename, Add or Remove Feature
12 – Windows Update, Add or Remove Feature
13 – Configuration Manager, Windows Update, Add or Remove Feature
14 – File Rename, Windows Update, Add or Remove Feature
15 – Configuration Manager, File Rename, Windows Update, Add or Remove Feature

 

By Querying the SCCM DB, we can see what state a machine is in.

 

Screen2

Note we are only looking here for machines that DO require a reboot.

So Far we have identified now that there are machines in our environment that do require restarts, and had a look at the different states that a machine can report on.

Restarting Machines

So how do I go about Restarting a machine?

There are 2 main ways :

1. Straight out of the console

Screen3

The first and easiest way to handle a small number of machines, is by selecting 1(or more machines) – Right click – Client Notification – Restart

This will cause a Popup Notification on the User Machines to appear.

The User will have 2 Options, Restart or Hide

 

2. Create a Collection that will list all the machines that require a restart.

This is the option when machines need to be Targeted for a restart en masse

Whether it is users that do not restart machines, or a restart required for applying a Out of Band Update, this is a quick way to group machines together, and schedule a Restart Task Sequence

 

Screen4

 

SQL Query for Collection

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 join sms_combineddeviceresources on sms_combineddeviceresources.resourceid = sms_r_system.resourceid where sms_combineddeviceresources.clientstate != 0

 

SQL Query for Report

 

We now have a Collection of all the machines that require restarts.

I still need to be able to report to business WHERE those machines are, WHO is using them, WHAT Operating System are they using?

 

This is where you can create a report very easily using the query below.

This will list the Machine Names, Operating Systems, State, State Meaning, Last Logged On User, Last Active time for the machine

 

SELECT        Name AS [Pending restart Clients], ADSiteName, ClientState,
          (SELECT CASE [ClientState] 
WHEN '1' THEN 'Configuration Manager' WHEN '2' THEN 'File Rename' WHEN '3' THEN 'Configuration Manager, File Rename' WHEN '4' THEN 'Windows Update'
WHEN '5' THEN 'Configuration Manager, Windows Update' WHEN '6' THEN 'File Rename, Windows Update' WHEN '7' THEN 'Configuration Manager, File Rename, Windows Update' 
WHEN '8' THEN 'Add or Remove Feature' WHEN '9' THEN 'Configuration Manager, Add or Remove Feature' WHEN '10' THEN 'File Rename, Add or Remove Feature'
WHEN '11' THEN 'Configuration Manager, File Rename, Add or Remove Feature' WHEN '12' THEN 'Windows Update, Add or Remove Feature' 
WHEN '13' THEN 'Configuration Manager, Windows Update, Add or Remove Feature' WHEN '14' THEN 'File Rename, Windows Update, Add or Remove Feature'
WHEN '15' THEN 'Configuration Manager, File Rename, Windows Update, Add or Remove Feature' ELSE 'Unknown' END AS Expr1) AS [Client State Detail],
          (SELECT CASE WHEN DeviceOS LIKE '%Workstation 5.0%' THEN 'Microsoft Windows 2000' WHEN DeviceOS LIKE '%Workstation 5.1%' THEN 'Microsoft Windows XP' 
WHEN DeviceOS LIKE '%Workstation 5.2%' THEN 'Microsoft Windows XP 64bit' WHEN DeviceOS LIKE '%Server 5.2%' THEN 'Microsoft Server Windows Server 2003' 
WHEN DeviceOS LIKE '%Workstation 6.0%' THEN 'Microsoft Windows Vista' WHEN DeviceOS LIKE '%Server 6.0%' THEN 'Microsoft Server Windows Server 2008 R2'
WHEN DeviceOS LIKE '%Server 6.1%' THEN 'Microsoft Server Windows Server 2008' WHEN DeviceOS LIKE '%Workstation 6.1%' THEN 'Microsoft Windows 7' 
WHEN DeviceOS LIKE '%server 6.3%' THEN 'Microsoft Server Windows Server 2012 R2' WHEN DeviceOS LIKE '%server 6.2%' THEN 'Microsoft Server Windows Server 2012'
WHEN DeviceOS LIKE '%Workstation 6.2%' THEN 'Microsoft Windows 8' WHEN DeviceOS LIKE '%Workstation 6.3%' THEN 'Microsoft Windows 8.1' 
WHEN DeviceOS LIKE '%Workstation 10%' THEN 'Microsoft Windows 10' WHEN DeviceOS LIKE '%server 10%' THEN 'Microsoft Windows Server 2016'
ELSE 'N/A' END AS Expr1) AS [Operating System], LastLogonUser, LastActiveTime
FROM     dbo.vSMS_CombinedDeviceResources
WHERE    (ClientState > 0) AND (ClientActiveStatus = 1)

In Conclusion

The Introduction of the ClientState reporting into the Console has allowed us as Administrators, to get a view of what machines need a reboot, and why.

I hope that the Queries will help to guide you, and to help simplify your Daily Administration.

Comments (2)

  1. This is a great feature and we hope to make good use of it going forward. Why do some inactive devices still show a reason for a pending restart? Does the database only get updated once the client checks back in after the reboot?

    1. HI Cristopher

      Indeed, the DB will show only the most recent information it has, so if a client has not reported in for X days and has been marked as inactive, that status will remain, until a client checks back in.

      That is why the Last Activity field is added in the report

Skip to main content