In this tutorial, it is described how to configure Hard Disk Sentinel to provide the detected hard disk status information by Windows Management Instrumentation (WMI). This includes
the complete status of all hard disks, SSD, SSHDs and all storage devices
temperature, health, performance, text description of each devices which contain any possible error(s) displayed in Hard Disk Sentinel
complete self-monitoring (S.M.A.R.T.) information about the detected devices
status values, bad sector count and count of possible other different kind of errors/issues
and so.
Registered (complete) Hard Disk Sentinel Professional version required to be installed.
Enable Configuration -> Advanced Options -> Provide status information by WMI option.
Just open notepad, copy/paste the following code and save the file as hdsentinel-wmi-demo.vbs in any folder. Then double-clicking on the hdsentinel-wmi-demo.vbs file (or by starting cscript hdsentinel-wmi-demo.vbs ) gives the details obtained via WMI.
In the following example, you may replace the . in the first line ( strComputer = "." ) with the name / IP address of a remote computer where Hard Disk Sentinel Pro running and the WMI option enabled. This way it is possible to query staus remotely (assuming the proper user permissions available to connect via WMI).
strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\wmi") Set colItems = objWMIService.ExecQuery("Select * from HDSentinel",,48) For Each objItem in colItems Wscript.Echo "ID: " & objItem.ID Wscript.Echo "ModelID : " & objItem.ModelID Wscript.Echo "SerialNumber : " & objItem.SerialNumber Wscript.Echo "FirmwareRevision: " & objItem.FirmwareRevision Wscript.Echo "Interface : " & objItem.Interface Wscript.Echo "PowerOnTime : " & objItem.PowerOnTime Wscript.Echo "PowerOnHours : " & objItem.PowerOnHours Wscript.Echo "StartStopCount : " & objItem.StartStopCount Wscript.Echo "BadSectorCount : " & objItem.BadSectorCount Wscript.Echo "WeakSectorCount : " & objItem.WeakSectorCount Wscript.Echo "SpinRetryCount : " & objItem.SpinRetryCount Wscript.Echo "CommIssueCount : " & objItem.CommunicationIssueCount Wscript.Echo "StatusCode : " & objItem.StatusCode Wscript.Echo "TRIMStatus : " & objItem.TRIMStatus Wscript.Echo "Report : " & objItem.Report Wscript.Echo "TemperatureC : " & objItem.TemperatureC Wscript.Echo "Health % : " & objItem.Health Wscript.Echo "Performance % : " & objItem.Performance Wscript.Echo "LifetimeWriteMB : " & objItem.LifetimeWriteMB Wscript.Echo "SMART : " & objItem.SMART WScript.Echo "" Next
Sample output:
Note: cscript may display partial S.M.A.R.T. information. When the script launched by double-click, complete self-monitoring data displayed:
The detected and reported information can be used to identify the devices (based on the displayed Model ID, Serial Number, Firmware Revision fields - plus the Interface field shows the current disk interface, as displayed on the Information page in Hard Disk Sentinel.
The following fields give additional details, status and statistical information:
PowerOnHours - power on hours value (without converting to days, just raw value)
StartStopCount - total start/stop (power cycle) count
BadSectorCount - total bad sector count displayed in the text description
WeakSectorCount - total weak / pending sector count displayed in the text description
SpinRetryCount - total spin retries count displayed in the text description
CommunicationIssueCount - total data communication problems displayed in the text description
StatusCode - disk status:
0 = unknown
1 = perfect (no problems found)
other values work as a bit mask, so all problems (if found) added. Generally larger number means more and more serious problems:
2 = communication problems found
4 = weak sectors found
8 = bad sectors found
16 = spin up problems found
32 = health of the disk is low (below 25%)
64 = failure predicted (health is 0%)
TRIMStatus - status of TRIM function:
0 = TRIM not available
1 = TRIM available and working
2 = TRIM available but not working (may be limited by driver as described at I believe TRIM is enabled but it is DISABLED. Why? )
SMART - complete self-monitoring (S.M.A.R.T.) status of the drive, in text format. Each lines contain 1-1 attributes and the attribute fields are separated by , (comma) and appears as on the S.M.A.R.T. page (ID, name, threshold, value, worst, status flags, raw data)
The following sample source code shows how to access disk status information by C#. Thanks for B.F. for sharing the source.
It may be good idea to combine WMI function with with other functions, for example the XML export, when status information automatically exported to XML reports which can be also read and processed.
Also it is good solution to use Hard Disk Sentinel in service mode. This way the software runs in the background "silently" as NT Service and without affecting the current user, it is possible to use these functions to detect and read/parse/process the collected status information (in addition to possible other options, for example alerts), making ideal solution to monitor status of computers where users have limited user rights only - or even computers (servers) where there is no active user at all.
Feel free to submit questions, suggestions or possible other requirements to info (at) hdsentinel (dot) com e-mail address. If you create and want to share 3rd party add-on(s) based on this function, feel free to contact and it can be added to the Add-ons page to help other users too.