Tuesday 22 November 2011

How ro check the remote server uptime

How to check the remote server uptime
 1) For local server

Use the command c:\uptime

2) For remote server

use the command c:\uptime \\server name



3) For multiple servers


Create a folder by name uptime in c:\uptime

Copy the below content and paste it in a notepad and save it as .vbs (ex: uptime.vbs) in c:\uptime

create 2 blank text files by name input.txt and output.txt

copy the uptime.exe file to C:\uptime folder

now you have 4 files in c:\uptime folder

C:\uptime\input.txt,

C:\uptime\output.txt

C:\uptime\uptime.exe

C:\uptime\uptime.vbs

---------------------------------------------------------------------------------------------------

Set fs = CreateObject ("scripting.filesystemobject")
Set ts = CreateObject ("WScript.shell")
Set ms = fs.OpenTextFile ("C:\Uptime\input.txt", 1, True)
Set js = fs.OpenTextFile ("D:\Uptime\output.txt", 2, True)

Do While ms.AtEndOfLine True
strcom = ms.ReadLine
set us = ts.Exec ("c:\Uptime\uptime "& strcom)
rs = us.StdOut.ReadAll

js.WriteLine rs

js.WriteBlankLines (1)

Loop
-------------------------------------------------------------------------------------------------



when you need to check the multiple servers uptime, just add the servers list in notepad and run uptime.vbs from command line( or right click on uptime.vbs and click open with command prompt.


Check the output.txt file to see the multiple servers uptime happy

No comments:

Post a Comment

Do not post irrelevant comments, please!

Browser Name:
Browser Version:
Browser Code Name:
User-Agent: