Solved

Use Chkdsk Exit Code to generate Alert

Posted on 2009-05-19
3
651 Views
Last Modified: 2012-05-07
Hello

I am looking to write a script - (vbscript or batch file or combo of both) to run chkdsk on all fixed disks on a given system (mostly servers) in read only mode.  If chkdsk encounters problems it would use the chkdsk exit codes or info in the chkdsk log to write alert us somehow that we should run a chkdsk /r

I believe I know how to do the actual alerting piece.  But how to pull the info from a chkdsk log or read the chkdsk exit codes is where I'm unsure
0
Comment
Question by:ITApprendista
3 Comments
 
LVL 3

Expert Comment

by:Cameron_S
ID: 24425609
You could write the script so the output of the chkdsk is put to a flat file (text file), then just have your script parse the flat file for the results and take action from there.
0
 
LVL 14

Expert Comment

by:BigBadWolf_000
ID: 24425747
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 24426102
For a VBScript solution...
See: http://msdn.microsoft.com/en-us/library/ateytk4a(VS.85).aspx
and: http://msdn.microsoft.com/en-us/library/za76z6hh(VS.85).aspx

Example:

    Dim WshShell, oExec
    Set WshShell = CreateObject("WScript.Shell")
 
    Set oExec = WshShell.Exec("calc") ' <--- replacing "calc" with your app to run
 
    Do While oExec.Status = 0
         WScript.Sleep 100
    Loop
 
    WScript.Echo oExec.ExitCode

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question