→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
FrankW
Engaged Sweeper III
hi,
i'm pretty sure that the field "LastBootUpTime" has been in tbloperatingsystem (before update to v5). Can someone give me a hint where to find it in v5? 🙂

thx in advance

-frank
1 ACCEPTED SOLUTION
RCorbeil
Honored Sweeper II
Confirmed you can use uptime. See this thread. That's the easy way.

If you want to use the last power-on event from tblUptime, you can do it with something like this:
SELECT TOP 1000000
tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
u.EventTime As LastPowerOn,
DateDiff(d, u.EventTime, GetDate()) As DaysAgo
FROM
tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
LEFT JOIN ( SELECT DISTINCT
tblUptime.AssetId,
Max(tblUptime.EventTime) As EventTime,
tblUptime.EventType
FROM
tblUptime
WHERE
tblUptime.AssetID = tblUptime.AssetID
AND tblUptime.EventType = 1
GROUP BY
tblUptime.AssetId,
tblUptime.EventType
) AS u ON u.AssetID = tblAssets.AssetID
WHERE
tblAssetCustom.State = 1
AND tsysAssetTypes.AssetTypename = 'Windows'

View solution in original post

3 REPLIES 3
RCorbeil
Honored Sweeper II
Confirmed you can use uptime. See this thread. That's the easy way.

If you want to use the last power-on event from tblUptime, you can do it with something like this:
SELECT TOP 1000000
tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
u.EventTime As LastPowerOn,
DateDiff(d, u.EventTime, GetDate()) As DaysAgo
FROM
tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
LEFT JOIN ( SELECT DISTINCT
tblUptime.AssetId,
Max(tblUptime.EventTime) As EventTime,
tblUptime.EventType
FROM
tblUptime
WHERE
tblUptime.AssetID = tblUptime.AssetID
AND tblUptime.EventType = 1
GROUP BY
tblUptime.AssetId,
tblUptime.EventType
) AS u ON u.AssetID = tblAssets.AssetID
WHERE
tblAssetCustom.State = 1
AND tsysAssetTypes.AssetTypename = 'Windows'
Hemoco
Lansweeper Alumni
You can also use field "uptime" in tblassets
KristofVansant
Engaged Sweeper
I did something like:

Select Top 1000000 tblUptime.AssetId,
tblAssets.AssetName,
Max(tblUptime.EventTime) As laststart,
tblAssets.OScode
From tblAssets
Inner Join tblUptime On tblAssets.AssetID = tblUptime.AssetId
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Where tblUptime.EventType = 1 And tblAssetCustom.State = 1
Group By tblUptime.AssetId,
tblAssets.AssetName,
tblAssets.OScode

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now