cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
vmicovic
Engaged Sweeper II
Dear, i looking for report which can show me which computers need to be restarted.
Is there existing one?

thank you.
1 ACCEPTED SOLUTION
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

View solution in original post

3 REPLIES 3
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
vmicovic
Engaged Sweeper II
Thank you, i get working with this:
regpath:
SYSTEM\CurrentControlSet\Control\Session Manager
regvalue:
PendingFileRenameOperations
Susan_A
Lansweeper Alumni
This information isn't scanned by default as far as I know. If it's stored in the registry, you can use the custom registry scanning feature documented here to retrieve it. A quick online search seems to indicate that there are values in the registry keys below that you can use to determine whether a Windows computer requires a reboot. You may need to research this further though.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\UpdateExeVolatile
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations