Solved

Use Chkdsk Exit Code to generate Alert

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

688 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