Is there a way to monitor how long windows has been up and running since the last reboot?
Thanks for any help on this.
~Rain
Windows uptime help
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
A quick google search found this:
http://support.microsoft.com/kb/232243/en-us
Maybe you could script that?
[/quote]
http://support.microsoft.com/kb/232243/en-us
Maybe you could script that?
[/quote]
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Thanks for the quick reply, how ever, I came across the same link before I posted my question and can't figure out how to use macro scheduler to monitor the system uptime.
What I would like to do is have macro scheduler run in the back round, check the system uptime and if a system has been up for X number of days or hours open a message window. I'm not sure how to get it to work without using the uptime.exe.
Any way, thank you for your time I will do some more google searching, maybe I can find a different way.
What I would like to do is have macro scheduler run in the back round, check the system uptime and if a system has been up for X number of days or hours open a message window. I'm not sure how to get it to work without using the uptime.exe.
Any way, thank you for your time I will do some more google searching, maybe I can find a different way.
One simple plan would be to write the time and date to a file as the computer boots up, then write a macro that reads the file and compares it to the "current" time and date.
For Example:
Put the following lines in a .bat file and put that file in the startup folder.
echo | more | time | find "current" > c:\timelog_.txt
echo | more | date | find "current" >> c:\timelog_.txt
every time the computer is rebooted the file c:\timlog_.txt will contain something like:
The current time is: 16:12:52.93
The current date is: 03/09/2006
Reflecting approximate date and time that the computer was booted.
Sorry, if I had more time I'd post a sample script to do the comparison.
Hope this is adequate to give you the concept.
Dick
For Example:
Put the following lines in a .bat file and put that file in the startup folder.
echo | more | time | find "current" > c:\timelog_.txt
echo | more | date | find "current" >> c:\timelog_.txt
every time the computer is rebooted the file c:\timlog_.txt will contain something like:
The current time is: 16:12:52.93
The current date is: 03/09/2006
Reflecting approximate date and time that the computer was booted.
Sorry, if I had more time I'd post a sample script to do the comparison.
Hope this is adequate to give you the concept.
Dick
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
This is how I get the uptime of a remote machine to put on a webpage.
Download and install uptime.exe from microsoft http://www.microsoft.com/ntserver/nts/d ... efault.asp
Script it in macro scheduler with the output redirected to a text file:
Run>cmd /c c:\upt\uptime.exe > c:\upt\uptime.txt
The text file is a single line like:
asffgsdgas has been up for: 0 day(s), 1 hour(s), 46 minute(s), 15 second(s)
You can then use macro scheduler to manipulate that any way you like.
Download and install uptime.exe from microsoft http://www.microsoft.com/ntserver/nts/d ... efault.asp
Script it in macro scheduler with the output redirected to a text file:
Run>cmd /c c:\upt\uptime.exe > c:\upt\uptime.txt
The text file is a single line like:
asffgsdgas has been up for: 0 day(s), 1 hour(s), 46 minute(s), 15 second(s)
You can then use macro scheduler to manipulate that any way you like.
I know it has been almost 5 years since my original post but I figured better late than never. The code below will display how much time has elapsed since the system was started or rebooted. The time is displayed in Days:Hours:Minutes:Seconds.
Code: Select all
LibFunc>kernel32.dll,GetTickCount,MillisecondsTickCount
Let>SecondsTickCount={%MillisecondsTickCount% DIV 1000}
Let>ElapsedSeconds={Round(%SecondsTickCount%)}
Let>DaysElapsed={%ElapsedSeconds% DIV 86400}
Let>ElapsedSeconds={%ElapsedSeconds% MOD 86400}
Let>HoursElapsed={%ElapsedSeconds% DIV 3600}
Let>ElapsedSeconds={%ElapsedSeconds% MOD 3600}
Let>MinutesElapsed={%ElapsedSeconds% DIV 60}
Let>SecondsElapsed={%ElapsedSeconds% MOD 60}
Length>%DaysElapsed%,Len
if>Len=1
Let>DaysElapsed=0%DaysElapsed%
endif
Length>%HoursElapsed%,Len
if>Len=1
Let>HoursElapsed=0%HoursElapsed%
endif
Length>%MinutesElapsed%,Len
if>Len=1
Let>MinutesElapsed=0%MinutesElapsed%
endif
Length>%SecondsElapsed%,Len
if>Len=1
Let>SecondsElapsed=0%SecondsElapsed%
endif
mdl>%DaysElapsed%:%HoursElapsed%:%MinutesElapsed%:%SecondsElapsed%
You can use powershell as well
You can use powershell as well if you want to do more operations based on uptime.
http://techibee.com/powershell/get-comp ... rshell/659
Thanks,
http://techibee.com/powershell/get-comp ... rshell/659
Thanks,