Solved

Use Chkdsk Exit Code to generate Alert

Posted on 2009-05-19
3
653 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 86

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
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.

734 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