→ Celebrate SysAdmin Day 2024 with Lansweeper Enter our Giveaway here

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Lindner
Engaged Sweeper III
Hello,

We use lansweeper v5.
I scan the file "bootstat.dat" to show how long the computer runs without powering down.
The date is shown as "05/02/2013 11:13:00".
How can i filter out the current day?
I tried it with "GetDate()" but that doesn't work.
...


regards
Andreas


I found the solution:
"<> GetDate()" doesnt work, but "< GetDate() - 1" works fine...
1 ACCEPTED SOLUTION
Lindner
Engaged Sweeper III
Hi,
thanks, i think, now it is perfect.
(I filtered the uptime > 12h)

SQL:

Select Top 10000 tblAssets.AssetID,
tblAssets.AssetUnique,
tblAssets.Lastseen,
Floor(Floor(Floor(tblAssets.Uptime / 60) / 60) / 24) As days,
Floor(Floor(tblAssets.Uptime / 60) / 60) - (Floor(Floor(Floor(tblAssets.Uptime
/ 60) / 60) / 24) * 24) As hours,
Floor(tblAssets.Uptime / 60) - (Floor(Floor(tblAssets.Uptime / 60) /
60) * 60) As min,
tblAssets.Uptime - Floor(tblAssets.Uptime / 60) * 60 As sec
From tblAssetCustom
Inner Join tblAssets On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Where tblAssets.Uptime > 43200 And tblComputersystem.Domainrole = 1 And
tblAssetCustom.Manufacturer <> 'VMware, Inc.' And tblAssetCustom.State = 1
Order By tblAssets.Uptime Desc


regards
Andreas

View solution in original post

7 REPLIES 7
chads
Lansweeper Alumni
Thanks for the report 🙂 sorry i stole it but love it helps a lot
Lindner
Engaged Sweeper III
Hi,
thanks, i think, now it is perfect.
(I filtered the uptime > 12h)

SQL:

Select Top 10000 tblAssets.AssetID,
tblAssets.AssetUnique,
tblAssets.Lastseen,
Floor(Floor(Floor(tblAssets.Uptime / 60) / 60) / 24) As days,
Floor(Floor(tblAssets.Uptime / 60) / 60) - (Floor(Floor(Floor(tblAssets.Uptime
/ 60) / 60) / 24) * 24) As hours,
Floor(tblAssets.Uptime / 60) - (Floor(Floor(tblAssets.Uptime / 60) /
60) * 60) As min,
tblAssets.Uptime - Floor(tblAssets.Uptime / 60) * 60 As sec
From tblAssetCustom
Inner Join tblAssets On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Where tblAssets.Uptime > 43200 And tblComputersystem.Domainrole = 1 And
tblAssetCustom.Manufacturer <> 'VMware, Inc.' And tblAssetCustom.State = 1
Order By tblAssets.Uptime Desc


regards
Andreas
Hemoco
Lansweeper Alumni
You can perform calculations with SQL fields.

Ceiling (tblAssets.Uptime / 60 ) -> uptime in minutes
Ceiling (tblAssets.Uptime / 60 / 60) -> uptime in hours
Ceiling (tblAssets.Uptime / 60 / 60 / 24) -> uptime in days
Lindner
Engaged Sweeper III
Hello,
my statement above was not correct: the uptime in the table and the time shown on the asstetpage are the same and correct.
My only problem now is that the uptime is shown in seconds...

Here is my sql:

Select Top 10
tblAssets.AssetID,
tblAssets.AssetUnique,
tblAssets.Lastseen,
tblAssets.Uptime As [Uptime [sec]]]
From tblAssetCustom
Inner Join tblAssets On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Where
tblComputersystem.Domainrole = 1 And
tblAssetCustom.Manufacturer <> 'VMware, Inc.'
And tblAssetCustom.State = 1
Order By tblAssets.Uptime Desc

Description:
tblComputersystem.Domainrole = 1 -> only computer, no server
tblAssetCustom.Manufacturer <> 'VMware, Inc.' -> no vmware clients
tblAssetCustom.State = 1 -> state 'active'

regards
Andreas
KRH
Engaged Sweeper
It would be nice to have a report example top 10 computers with most uptime and exclude servers.
Lindner
Engaged Sweeper III
Hi,

but i want to show, which user don't power off the computer.
The uptime shows only the time between power on and now.
If the computer was not seen for a while, i don't know if it was powered on or off.
The field "uptime" on the summary page of the computer shows it correct, i think.
(time between power on and scantime)

can i count in a report like : [scantime] - [lastmodofied] > 5
-> it was powered on for 5 days as the computer has been scanned...


regards
Andreas
Hemoco
Lansweeper Alumni
Note that uptime scanning is built into Lansweeper 5.0. The uptime field can be found in the tblAssets database table.