Overview
You have a machine that shows an exclamation mark next to the name in the Computer Tree. LanGuard says that a reboot is pending. Checking the Dashboard > Overview tab, you see the following message:
"Reboot computer to complete updates deployment" but you have already:
- Rebooted the machine.
- Scanned it with a profile like Full Scan or System Information that checks for reboots since the last update.
Solution
Run the following PowerShell script on the target to check the reboot status:
function Test-PendingFileRename {
[OutputType('bool')]
[CmdletBinding()]
param()
$operations = (Get-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\').GetValue('PendingFileRenameOperations')
if ($null -eq $operations) {
$false
}
else {
$trueOperationsCount = $operations.Length / 2
$trueRenames = [System.Collections.Generic.Dictionary[string, string]]::new($trueOperationsCount)
for ($i = 0; $i -ne $trueOperationsCount; $i++) {
$operationSource = $operations[$i * 2]
$operationDestination = $operations[$i * 2 + 1]
if ($operationDestination.Length -eq 0) {
Write-Verbose "Ignoring pending file delete '$operationSource'"
}
else {
Write-Host "Found a true pending file rename (as opposed to delete). Source '$operationSource'; Dest '$operationDestination'"
$trueRenames[$operationSource] = $operationDestination
}
}
$trueRenames.Count -gt 0
}
}
function Test-PendingReboot {
if (Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -EA Ignore) { return $true }
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA Ignore) { return $true }
if (Test-PendingFileRename) { return $true }
try {
$util = [wmiclass]"\\.\root\ccm\clientsdk:CCM_ClientUtilities"
$status = $util.DetermineIfRebootPending()
if (($status -ne $null) -and $status.RebootPending) {
return $true
}
}
catch { }
return $false
}
Test-PendingReboot
For ease of use, simply copy the code above in a file with the extension of .ps1 (not .txt.ps1) and execute it in a PowerShell terminal window.
Note the result.
- If the result is False, it means that the script detected that a reboot is not pending. Reboot the machine and run a successful System Information scan (or a profile like Full Scan which contains this component) with no errors on the target. Check if the reboot required flag is gone.
- If the result is True, it means that the script detected that a reboot is still pending. Reboot the machine and run the script again. Should the result continue to be True, troubleshoot this discrepancy internally with the help of your IT team as Windows itself is recognizing that a reboot is pending, which is what is shown within LanGuard.
Summary
A PowerShell script is used to check the reboot pending status on the machine itself. Once the script returns False, it is expected that a successful System Information scan (or a profile like Full Scan which contains this component) will clear the reboot pending status within LanGuard as well.