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:
http://www.anchor.com.au/hosting/dedicated/monitoring_windows_software_raid
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.
Best Answer
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:
Or if you wanted to loop through a bunch of drives you could do something like:
From the linked site here are the options of the status output: