cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post

Last Boot Greater Than X Days But Less Than X Days

Was recently asked for a report that would show Windows nodes where last boot is greater than X number of days but less than X number of days. After a bit of research I was able to put together the following using some custom SQL. As is, the report shows Windows nodes where Last Boot is greater than 35 days but less than 65 days.

SELECT

Nodes.NodeID AS NodeID, Nodes.Caption AS NodeName, Nodes.MachineType AS Machine_Type,

Nodes.Vendor AS Vendor, Nodes.LastBoot AS Last_Boot,

Nodes.StatusDescription AS Status_Description,

Nodes.caption,'/Orion/NetPerfMon/NodeDetails.aspx?NetObject=N:'+CAST(Nodes.NodeID as varchar(256)) as 'DetailsURL'

FROM

Nodes

WHERE LastBoot < DATEADD(day, -35, GetDate()) AND LastBoot > DATEADD(day, -65, GetDate())

AND Nodes.Vendor = 'Windows'

ORDER BY Last_Boot DESC

To modify the range look to the following line.

WHERE LastBoot < DATEADD(day, -35, GetDate()) AND LastBoot > DATEADD(day, -65, GetDate())

To modify the Vendor, Windows, look to the following line.

AND Nodes.Vendor = 'Windows'

BTW, I'm no SQL guru, I'll do my best to answer any questions but it might take a while.

Tags (1)
Attachments
Version history
Revision #:
1 of 1
Last update:
‎08-03-2018 01:42 PM
Updated by: