Sign in to follow this  
Followers 0
polps

Timer question

3 posts in this topic

Hello all,

how to get the time elapsed since the computer is powered on?

Thanks

Share this post


Link to post
Share on other sites



Hello all,

how to get the time elapsed since the computer is powered on?

Thanks

Hi,

try this:

$strComputer = "."
$objWMIService = ObjGet ("winmgmts:\\" & $strComputer & "\root\cimv2")
$colitem = $objWMIService.ExecQuery ("Select * From Win32_PerfFormattedData_PerfOS_System"); Where Default = True")
For $objos in $colitem
    $systemuptime = Int ($objos.systemuptime / 60)
    MsgBox (0, "", $systemuptime & " minutes")
Next

Share this post


Link to post
Share on other sites

Yes, it works perfectly!

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0