How to: query disk information by WMI from Hard Disk Sentinel

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


Registered (complete) Hard Disk Sentinel Professional version required to be installed.


Enable Configuration -> Advanced Options -> Provide status information by WMI option.

Configuration -> Advanced options


Example: detect status by VBS script

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 ""

Sample output:

Hard Disk Sentinel WMI output NVMe SSD
Hard Disk Sentinel WMI output SATA hard disk drive

Note: cscript may display partial S.M.A.R.T. information. When the script launched by double-click, complete self-monitoring data displayed:

Hard Disk Sentinel WMI output SATA hard disk drive S.M.A.R.T.


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:

Example: detect hard disk status by C#

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.



Hard Disk Sentinel Home






Useful links

Download Hard Disk Sentinel

Frequently asked questions

Knowledge base

Discussion forum

Contact us

Privacy policy


Q&A Knowledge Base


Use Case

HDSentinel on Facebook

HDD Monitoring Blog



Enter your e-mail address to receive news, tips, updates and special offers about Hard Disk Sentinel software. More ...

Your e-mail address is kept securely (see our privacy policy).

© 2023 H.D.S. Hungary. All Rights Reserved.

Software for hard disk monitoring and data protection