Solved

Use Chkdsk Exit Code to generate Alert

Posted on 2009-05-19
3
648 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now