This week I’m still staying in the new features of Configuration Manager, version 1710. This time it’s all about how easy it became to restart a client device. Restarting a client device became a right-click action! It simply couldn’t be easier! This opens up a whole new world for managing client devices with a pending restart. In this blog post, I’ll start with a short introduction about restarting a client device, followed by the simple actions to trigger a restart for a client device. I’ll end this post by following the activity through the log files.
Introduction
Starting with Configuration Manager, version 1710, it’s possible to use the Configuration Manager console to identify client devices that require a restart, and then use a client notification action to restart those client devices. When the restart notification is received by a client device, a notification window opens to inform the user about the restart. By default, the restart occurs after 90 minutes. That might sound like a long period, but that’s related to the configuration of the Client Settings. The restart simply honors the restart behavior, as configured in the Computer Restart tab of the Client Settings.
Trigger a restart
Now let’s have a look at triggering a restart of a client device. The easiest method to trigger a restart, of a client device, is to first identify client devices that are pending a restart, followed by right-clicking those devices and selecting restart. To perform these activities, simply follow the next steps:
Follow the restart
The best method to follow the restart, of the client device, is by using the log files. At least the following three log files are related to this action and together those log files provide a lot of information:
BgbServer.log: This log file records the activities of the notification server, such as client-server communication and pushing tasks to clients. It also records information about the generation of online and task status files to be sent to the site server. When triggering a restart of the client device, this log file shows the information about pushing the restart task to the client device, followed by information about the generation of the BGB task status report (.BTS) in the bgb.box inbox (see below). |
CcmNotificationAgent.log: This log file records the activities of the notification agent, such as client-server communication and information about tasks received and dispatched to other client agents. When triggering a restart of the client device, this log file shows the arrival of the restart task on the client device (see below). |
bgbmgr.log: This log file records details about site server activities related to client notification tasks and processing online and task status files. When triggering a restart of the client device, this log file will show information about processing the created BGB task status report (.BTS) from the bgb.box inbox. |
Note: The log snippets above show how quick the notification arrives on the client device. In my test environment that was within the same second.
More information
For more information about the restart client device option, please refer to this article about How to manage clients.
I search a for a script based trigger method for this way (best would be on the Client itself) ….
Hi Michael,
What are you trying to achieve? There are many methods for remotely restarting devices..
Regards, Peter
Hi Peter,
Is there a possible way to restart the systems listed in Device Collections without user confirmation? We have around 1000 systems are going over 1by1 with the user won’t be feasible.
Please advise. Thank you
Hi Joy,
Are you saying that you don’t have the usual countdowns?
Regards, Peter
Hi Peter,
We would like to schedule the restart trigger for our workstations that are pending restart only. Any ideas for this?
Thanks!
Dave
Hi Dave,
In that case, at this moment, I would look at an old-school package.
Regards, Peter
Is there a way to invoke the restart from Config Mgr using a power shell? I am trying to write a script where we can Invoke Restart config manager instead of giving shutdown /r command to a computer.
Hi Neil,
What are you trying to achieve?
Regards, Peter
Hi Peter
As Michael in the first post does, I too search for a way to trigger the SCCM restart with notification, but through a command line from an application running on the client PC’s ?
Like below command actually does (but only from the server or a PC with Config mgr console installed):
set-location PRI:
Invoke-CMClientAction -DeviceName “computername” -ActionType ClientNotificationRebootMachine
Hi Thomas,
I haven’t yet looked at what is being triggered on the client device.
Regards, Peter
Hi Dave
We just had the same issue.
The following script can be run as an application (just set a condition that is never true and CCM will keep retrying to run it) and will return a 3010 exit code to SCCM when a pending reboot of any of the four sorts are present. Otherwise returns original exitcode. SCCM will then schedule a proper reboot session and notify the user.
Note, this MUST be an APPLICATION as return codes from packages are not handled by SCCM.
function Test-RebootRequired
{
# Initialize result array
$result = @{
CBSRebootPending = (Get-ChildItem “HKLM:Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending” -ErrorAction SilentlyContinue).CBSRebootPending
WindowsUpdateRebootRequired = (Get-Item “HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired” -ErrorAction SilentlyContinue).WindowsUpdateRebootRequired
FileRenamePending = (Get-ItemProperty “HKLM:SYSTEM\CurrentControlSet\Control\Session Manager” -Name PendingFileRenameOperations -ErrorAction SilentlyContinue).FileRenamePending
SCCMRebootPending = $false
}
# Complete result Array with SCCM client status
try
{
$util = [wmiclass]”\\.\root\ccm\clientsdk:CCM_ClientUtilities”
$status = $util.DetermineIfRebootPending()
if(($status -ne $null) -and $status.RebootPending){
$result.SCCMRebootPending = $true
}
}catch{}
# Normalize Result Array
if ($result.CBSRebootPending -eq $null){ $result.CBSRebootPending = $false }
if ($result.WindowsUpdateRebootRequired -eq $null){ $result.WindowsUpdateRebootRequired = $false }
if ($result.FileRenamePending -eq $null){ $result.FileRenamePending = $false }
#Return Reboot required
# Write-Output $result
if ($result.ContainsValue($true)){$host.SetShouldExit(“3010”)}
Return $result.ContainsValue($false)
}
#call the function
Test-RebootRequired
To test it run the following from a CMD
powershell.exe -file “\Test-RebootRequired.ps1”
and
echo %errorlevel%