Powershell monitoring drive mirrors
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Powershell monitoring drive mirrors
Hello,Is there a way to use a Powershell script in Windows Server 2003 to periodically monitor (user configurable time period) the event log (or other status method) for whether or not a drive mirror has failed?Thanks
Powershell monitoring drive mirrors
You might be able to use the Win32_DiskDrive class and periodically check the status:get-wmiobject win32_diskdrive -computer "SERVER01" -filter "Status <> 'OK'" | Select Caption,Model,NameOr in a script you might use code like this:$check=gwmi win32_diskdrive -computer "SERVER01" -filter "Status <> 'OK'"if ($check) {"do something"}This approach is much better if you have to monitor several servers. You could set it up as a scheduled task and run it every 5 minutes.
Powershell monitoring drive mirrors
Then I would write a Powershell script to use my WMI query example against one or more computers and schedule it to run from your desktop or someplace every 10 minutes. You might first test it by changing the filter to Status='OK' to verify this class will do what you need. I don't have a software RAID anywhere handy where I can test. I also hope you have an environment where you can test for failed disks.
Powershell monitoring drive mirrors
Jeff, thanks - I will give this a try and let you know what happens.