About Hard disk health

Comments

8 comments

  • Monica KVH

    If you know how to do that via command line, you can run remote commands in PDQ Inventory, and the results will come back in the remote command window.

    As an example, you can open a computer, use the "Remote Command" option from the Tools tab, and run chkdsk C: and once it's complete you'll see everything you expect to see from chkdsk.

    0
    Comment actions Permalink
  • SelfMan

    Hi Pushpak,
    if you need extended health information of your hard drives, you can reach for SmartCTL. Its a free tool from SmartTools. I have a script which I deploy via PDQ Deploy and it sends me a email with a extended report attached. If you wish I can share.

    0
    Comment actions Permalink
  • Pushpak Patil

    Yes Please, It will be really helpful.

    Thanks Selfman.

     

    0
    Comment actions Permalink
  • SelfMan

    Ok, the package contains:

    #run.cmd
    blat.dll
    blat.exe < command line mail http://www.blat.net/
    blat.lib
    blatdll.h
    doff.exe < Windows Date Display
    drivedb.h
    help.txt
    mail-body-FAILED.txt
    mail-body-PASSED.txt
    smartctl.exe < command line SMART tools https://www.smartmontools.org
    update-smart-drivedb.exe < drivedb.h updater utility

    MAIL BODY FAILED:
    -------------------------------------
    HDD S.M.A.R.T. report
    HDD/SSD TEST RESULT: FAILED
    Check the logs for more information!
    <some signature>
    -------------------------------------

    MAILBODY PASSED
    -------------------------------------
    HDD S.M.A.R.T. report
    HDD/SSD TEST RESULT: PASSED
    Check the logs for more information!
    <some signature>
    -------------------------------------

    #run.cmd
    -------------------------------------
    @echo off
    setlocal EnableDelayedExpansion

    rem SMART Reporting batch

    for /f %%i IN ('doff.exe yyyymmdd') DO SET ThisDate=%%i

    set ReportDIR=C:\Windows\SMART-Reports
    set ReportLog="%COMPUTERNAME%-SMART-TEST.log"

    IF NOT EXIST %ReportDIR% mkdir %ReportDIR%

    smartctl.exe -x C: >%ReportLog%

    if exist %ReportLog% (
        @findstr /i /C:"SMART overall-health self-assessment test result: PASSED" %ReportLog% > NUL
        if !Errorlevel! EQU 0 (
            set testResult=PASSED
        ) else (
            set testResult=FAILED
        )
        blat -bodyF "mail-body-!testResult!.txt" -f <from mail> -to <to mail> -subject "SMART Report - %COMPUTERNAME% [%ThisDate%] - !testResult!" -server <your smtp server> :25 -noh -attach %ReportLog% -base64 -q -timestamp -log "%ReportDIR%\smart-mail.log"
        move %ReportLog% %ReportDIR%\%ThisDate%-%ReportLog%
    ) ELSE (
        echo %ThisDate% File attachment not found... >> %ReportDIR%\smart-scan.log
    )
    -------------------------------------
    - change the date format in Doff according your preferences.
    - specify from and to mail addresses
    - enter your SMTP host address (the one which handles your mailbox as its a direct delivery)
    - pack all the files using winrar in a self-extracting archive like smart-report.exe and specify #run.cmd to be executed after extraction

    ;The comment below contains SFX script commands

    Setup=#run.cmd
    TempMode
    Silent=1
    Overwrite=1

    0
    Comment actions Permalink
  • SelfMan

    Oh, I forgot the URL for Doff.exe
    http://wiki.inisec.com/index.php/Windows_Date_Display 

    The logs are allways stored in C:\Windows\SMART-Reports folder for later review, you might add some cleaning routine to the script as well.

    And as allways - use at your own risc ;-)

    0
    Comment actions Permalink
  • SelfMan

    blat.dll, blat.lib, blatdll.h and help.txt are not essential to run the script, they were just part of the packages. They are not needed.

    Oh and a Hint - when you load two of the reports in to WinMerge, you canvery nicely see what has changed, as the report is pretty extensive.

     

    0
    Comment actions Permalink
  • Pushpak Patil

    Fantastic :)

    one more favor please, can we rename the file as per result?

    For example: "02052017-Demo-PC-SMART-TEST.log" is the default name generated by your script

    Rename it to as per result,

    If failed : "02052017-Demo-PC-SMART-TEST-Failed.log"

    If passed : "02052017-Demo-PC-SMART-Passed.log"

     

    Thanks.

    0
    Comment actions Permalink
  • SelfMan

    You can change it the way you wish... There is no harm in it.
    But because of sorting of the files I recommend to stay wit the YYYYMMDD format.

    0
    Comment actions Permalink

Please sign in to leave a comment.