cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
AZHockeyNut
Champion Sweeper III
since win 10 schedules reboots outside of active hours, is there a report that can show all systems (does not need to be just win 10) that are still awaiting reboots?
4 REPLIES 4
R_jeschelnig
Engaged Sweeper II
The solution to check for "Updates need PC reboot" is to do few things:

1.) Make an group policy for adding 2 Computer Configuration>Preferences>Windows Settings>Registry entries.
2.) Make 2 entries
a.) First registry entry added by Domain policy (Just copy paste into the section)
<?xml version="1.0"?>
<Registry clsid="{9CD4B2F4-923D-47f5-A062-E897DD1DAD50}" name="RebootNeeded" status="RebootNeeded" image="11" changed="2019-10-15 13:12:22" uid="{B70ACCE8-D4CA-456F-BF56-BAB6CE3DDE31}" removePolicy="1" bypassErrors="1"><Properties action="R" displayDecimal="1" default="0" hive="HKEY_LOCAL_MACHINE" key="SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" name="RebootNeeded" type="REG_DWORD" value="00000000"/><Filters><FilterRegistry bool="AND" not="1" type="KEYEXISTS" hive="HKEY_LOCAL_MACHINE" key="SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" valueName="" valueType="" valueData="" min="0.0.0.0" max="0.0.0.0" gte="1" lte="0"/></Filters></Registry>

b) Second registry entry added by Domain policy: (Just copy paste into the section)
<?xml version="1.0"?>
<Registry clsid="{9CD4B2F4-923D-47f5-A062-E897DD1DAD50}" name="RebootNeeded" status="RebootNeeded" image="11" changed="2019-10-15 13:12:30" uid="{3240771F-1ABC-4AED-BD3F-5E7781C3C5F2}" removePolicy="1" bypassErrors="1"><Properties action="R" displayDecimal="1" default="0" hive="HKEY_LOCAL_MACHINE" key="SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" name="RebootNeeded" type="REG_DWORD" value="00000001"/><Filters><FilterRegistry bool="AND" not="0" type="KEYEXISTS" hive="HKEY_LOCAL_MACHINE" key="SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" valueName="" valueType="" valueData="" min="0.0.0.0" max="0.0.0.0" gte="1" lte="0"/></Filters></Registry>

3.) In Lansweeper add an entry to registry scanning
a.) RegPath= SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update
b.) RegValue= RebootNeeded

4.) Make this report (Obviously the Domain policy will have to be in affect and applied to the Windows PC's for the "Require Reboot?" results to show up.)

Select Top 1000000 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
SubQuery1.Value As [Require Reboot?],
tblAssets.Domain,
tblAssets.Username,
tblAssets.Lastseen,
tblAssets.Lasttried,
tblAssets.IPAddress,
tsysOS.OSname As OS,
Case
When tsysOS.OScode Like '10.0.10240%' Then '1507'
When tsysOS.OScode Like '10.0.10586%' Then '1511'
When tsysOS.OScode Like '10.0.14393%' Then '1607'
When tsysOS.OScode Like '10.0.15063%' Then '1703'
When tsysOS.OScode Like '10.0.16299%' Then '1709'
When tsysOS.OScode Like '10.0.17134%' Then '1803'
When tsysOS.OScode Like '10.0.17763%' Then '1809'
When tsysOS.OScode Like '10.0.18362%' Then '1903'
End As Version,
Case
When tblComputersystem.Domainrole > 1 Then 'Server'
Else 'Workstation'
End As [Workstation/Server],
tsysIPLocations.IPLocation,
Convert(nvarchar(10),Ceiling(Floor(Convert(integer,tblAssets.Uptime) / 3600 /
24))) + ' days ' +
Convert(nvarchar(10),Ceiling(Floor(Convert(integer,tblAssets.Uptime) / 3600 %
24))) + ' hours ' +
Convert(nvarchar(10),Ceiling(Floor(Convert(integer,tblAssets.Uptime) % 3600 /
60))) + ' minutes' As UptimeSinceLastReboot
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join TsysLastscan On tblAssets.AssetID = TsysLastscan.AssetID
Inner Join TsysWaittime On TsysWaittime.CFGCode = TsysLastscan.CFGcode
Left Join (Select Top 1000000 tblRegistry.AssetID,
tblRegistry.Regkey,
tblRegistry.Valuename,
tblRegistry.Value,
tblRegistry.Lastchanged
From tblRegistry
Where
tblRegistry.Regkey Like
'%SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update'
And tblRegistry.Valuename = 'RebootNeeded') SubQuery1 On
SubQuery1.AssetID = tblAssets.AssetID
Inner Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Inner Join tsysIPLocations On tsysIPLocations.LocationID =
tblAssets.LocationID
Where tblAssets.Lastseen Like tblAssets.Lasttried And Case
When tblComputersystem.Domainrole > 1 Then 'Server'
Else 'Workstation'
End Like 'Workstation' And tblAssetCustom.State = 1 And TsysWaittime.CFGname =
'registry'
Order By tblAssets.Domain,
tblAssets.AssetName
AZHockeyNut
Champion Sweeper III
managed to get it all working including an html report that gets emailed to me. I put it as a scheduled task in my wsus server to run every day. 🙂
AZHockeyNut
Champion Sweeper III
I found this script on the following (script is here)
if you run it directly on the wsus server it seems to indicate clients that are awaiting reboot. at least in a very quick test it did.


[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null

if (!$wsus) {
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();
}

$computerScope = new-object Microsoft.UpdateServices.Administration.ComputerTargetScope;
$computerScope.IncludedInstallationStates = [Microsoft.UpdateServices.Administration.UpdateInstallationStates]::InstalledPendingReboot;

$updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope;
$updateScope.IncludedInstallationStates = [Microsoft.UpdateServices.Administration.UpdateInstallationStates]::InstalledPendingReboot;

$computers = $wsus.GetComputerTargets($computerScope);

$computers | foreach-object {
$_.FullDomainName | write-host;

# Show which updates are causing the reboot required for the computer. Remove the next 5 lines to only generate a list of computers.
$updatesForReboot = $_.GetUpdateInstallationInfoPerUpdate($updateScope);
$updatesForReboot | foreach-object {
$neededUpdate = $wsus.GetUpdate($_.UpdateId);
" "+$neededUpdate.Title | write-host;
# Remove previous lines to only show computers that need updates
}
}
Esben_D
Lansweeper Employee
Lansweeper Employee
I would think you can create a report based on the information from this source: https://blogs.msdn.microsoft.com/hansr/2006/02/17/how-to-detect-if-a-reboot-is-needed-after-installing-a-patch/

Before running this report be sure to add the registry keys and values to your Lansweeper installation. Then rescan all your assets. However, please not that Lansweeper can't scan default values. Since the key automatically gets clean up after a reboot you will have to search scan for a specific value in the ReboorRequired key which will most likely be unique to each update.

You can find our sample report for registry keys here: https://www.lansweeper.com/Forum/yaf_postst10451_Value-of-a-value-name-submitted-for-custom-registry-scanning.aspx#post39295

This script might also work but then you would be looking at using it in a deployment.
https://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542