Subscribe to Windows IT Pro
July 11, 2002 12:00 AM

Post Uptime Reports to the Web

Windows IT Pro
InstantDoc ID #25646
Rating: (2)
Downloads
25646.zip

[Editor's Note: Email your scripting solutions (400 words or less) to Reader to Reader at winscriptsol@winnetmag.com. Please include your script and phone number. We edit submissions for style, grammar, and length. If we print your contribution, you receive $100.]

With the downturn in the economy, I've been doing a lot of metrics reporting. I devised the script that Listing 1, page 16, shows, which uses uptime.exe from the Microsoft Windows NT Server 4.0 Resource Kit (or at http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/winntas/downloads/uptime.asp) to report on server uptime and csv2html.exe from http://joncombe.future.easyspace.com to convert the Comma Separated Value (CSV) data into HTML for posting on a Web site. Figure 1, page 16, shows sample results.

Many Csv2html-type programs exist; I chose this one because it didn't require me to install Perl. Search for "CSV to HTML" at http://google.com to find utilities with other options.

Remember that you need proper rights to use the Uptime utility to pull events from the event log. You also need to modify the script with your environment's pathnames. The /s switch returns system statistics. The /f switch lets you specify the name of a file that lists the names of all the servers that you want to report on. The /t switch lets you specify the number of threads Uptime can use (the maximum is 25). You could also use the /v switch to collect all events, including shutdowns, restarts, OS failures, and service pack installations.

When your input is a list of servers, the standard output is a .csv file. After the script runs Csv2html to convert this file to HTML, the script copies the HTML file to a Web-publishing directory for everyone to view.

Alternatively, you could name the servers in the script and produce text output, which might be easier to read. You can then use the txt2html.pl utility from http://www.aigeek.com/txt2html to convert the text file to HTML for posting on the Web. Listing 2 shows a script that takes this approach and produces results like those that Web Figure 1 (http://www.winscriptingsolutions.com, InstantDoc ID 25646) shows. On an NT 4.0 workstation that's in the domain, use an AT command to schedule these scripts and let them run under Administrator permissions.

Related Content:

ARTICLE TOOLS

Comments
  • josephmcse
    8 years ago
    Sep 14, 2004

    IT would be Realy REALY Helpful that a link to botht he UPTIME.exe (2.0) or the UPTIME.exe wich supports the /T and /F on your website. AS well the csv2html.exe that is being mentioned. as External websites changes this article might be useless...

  • Robert
    8 years ago
    Apr 27, 2004

    The Windows 2000 Server Resource Kit does not have Uptime 2.0; it contains Uptime 1.0.0.1. I need 2.0, but I can't locate it.

  • Jim Day
    9 years ago
    Oct 06, 2003

    I think I finally figured this one out! You need to obtain the version of uptime.exe (v2.0) that is a part of the Windows Server 2000 Resource Kit. The author of this article listed that the uptime.exe was part of the WinNT 4.0 Resource Kit, but that is not v2.0. You have to use the Win2000 Server Resource Kit.



    Also in his example, you can't have spaces after the /f: parameter. The example should read as follows:



    uptime.exe /s /f:srvlst.txt /t:25



    You will then get two files as output, ServerFile.csv and ServerError.csv. The ServerFile.csv file is the file you will use as input to the csv2html program.



    Hope this will save others the time of having to figure all this stuff out. This article was not very accurate and as mentioned in another comment, you could not send the author an email as the provided email address is now invalid. Email me if you need a copy of the uptime.exe (version 2) program.

  • saurin
    10 years ago
    Aug 12, 2002

    Where do you get Uptime ver 2.0?

  • Thomas
    10 years ago
    Aug 02, 2002

    How do you get the "/f:" uptime switch to work?

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.