Rem: Track and Receive Messages About System Uptime

You can use the Uptime tool to keep track of a system’s uptime, then use Net Send to send messages about the uptime status.

Dick Lewis

January 12, 2005

1 Min Read
ITPro Today logo in a gray background | ITPro Today

On one of our servers, we have a memory leak that's caused by a problematic application. About every 30 days the server runs out of memory and becomes unresponsive, necessitating an ungraceful shutdown with the On/Off button. We're working with the software vendor to fix the problematic application, but in the interim, what can I do to get a reminder after the server has been up for 21 days?

At my company, we had a server with similar problems. About every 3 weeks, it would slow to a crawl and become unresponsive. The slowdown was due to a backup-client software problem, so there was little we could do but live with the situation until the vendor solved the problem. We knew we shouldn't stretch the uptime beyond 2 weeks, so I used Task Scheduler to run code that sent me a Net Send message when the server was up for 14 days or longer. Here's similar code that will notify you when your server has been up for 21 days or longer:

For /f "tokens=6" %%i in  ('Uptime MyServer') Do If %%i  GEQ 21 Net Send  MyComputer MyServer has  not been rebooted in %%i days.

In this code, replace MyServer with the name of the server you want to monitor and MyComputer with the name of the computer on which you want to receive the message. This computer must be running the Messenger service for the code to work.

The code uses the Uptime tool to determine the server's uptime. You can download this tool from http://www.microsoft.com/technet/archive/winntas/downloads/uptime.mspx, or you can find it in the Windows resource kits.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like