I want to write a script (using python or windows batch) to check if in the raid system on a winows 2003 server all disks are online, alive and synced.

This is the builtin windows 2003 software raid that I am using.

How can I get this information from a script that I run periodically?

Edit: I tried the code form the accepted answer. On my system all the disk information is given, except "Status", which always returns "None".

I found another soulution here:


Calling "echo list volume | diskpart" from a script and checking the returned output with regular expressions. There is one line for each drive. Possible string values for status depend on the language of your OS. Not very nice but works.


You're looking for the Win32_LogicalDisk WMI class (Specifically the status property)

You could use either PowerShell or VBScript to access this class.

Note I Don't have a Software Raid setup to test these against and they are just samples not fully fleshed out code

A quick PowerShell Script would look something like this:

$CheckDrive = gwmi -query "Select * from Win32_LogicalDisk where DeviceID='C:'"

Or if you wanted to loop through a bunch of drives you could do something like:

$CheckDrive = gwmi Win32_LogicalDisk
foreach ($i in $CheckDrive){$i.properties.Status}

From the linked site here are the options of the status output:


   Data type: string
   Access type: Read-only

Current status of the object. Various operational and nonoperational statuses can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard disk drive, may be functioning properly but predicting a failure in the near future). Nonoperational statuses include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is online, yet the managed element is neither "OK" nor in one of the other states. This property is inherited from CIM_ManagedSystemElement.

   The values are:

   "Pred Fail"
   "No Contact"
   "Lost Comm"
  • thank you for the fast reply, looks great, will try it out soon – user12096 Jan 14 '10 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.