RAID monitoring with StorCLI in Windows Server 2025
StorCLI is a command-line utility from Broadcom to monitor MegaRAID controller cards. This utility also works under Windows.
Start by downloading StorCLI from Broadcom's website (https://docs.broadcom.com/docs/1232743397).
Unzip the zip file on the dedicated server. Inside is a folder (storcli_rel) with another zip file (Unified_storcli_all_os.zip). Unzip that file as well.
In the unzipped folder, navigate to Unfied_storcli_all_os → Unified_storcli_all_os → Windows. Copy the file storcli64.exe to your home folder. In this guide, we'll use C:\Users\Administrator.
Querying the RAID controller
Open a Terminal window and navigate to where you copied storcli64.exe, for example, C:\Users\Administrator, if you aren't in the folder already.
cd C:\Users\AdministratorLet's try to view the status of the RAID controller card:
.\storcli64.exe /call show allThis will output several pages of information about the controller. To only get the current status of the controller card, you can use the JSON output and filter it, like so:
(.\storcli64.exe /call show all j | ConvertFrom-Json).Controllers[0]."Response Data".Status."Controller Status"
OptimalAutomating the monitoring
This script will send you an email if the status is not "Optimal". The script will be scheduled in the Task Scheduler to run once a day. Further, the script will run as the SYSTEM account.
Generating the SMTP credentials file
Since the script will run as the SYSTEM account, and you generally don't want login credentials lying around in plain text, you first need to create a credentials file for the SMTP server as the SYSTEM account.
To be able to execute commands as the SYSTEM account, you first need to download the psexec64 command. Execute the following command in a Terminal (with a PowerShell session):
Now, execute the following command to open a new PowerShell session as the SYSTEM account:
Finally, create the credentials file for the SMTP server using the following command. Adjust the path and filename to where you want to save the credentials file:
An interactive dialog box will now open. Enter your username and password for the SMTP server you intend to use to send email alerts.

Creating the script
The script will connect to an SMTP server to send the email. In this example, we'll use Glesys's email service. For this to work, you first need to create an email account. See Create an email account for more information. You can, however, use any SMTP server you have access to.
Create a file called raidcheck.ps1 with the following content. Place it in your home folder. Make sure to change the $StorCLI variable to where you copied storcli64.exe. Also, set the path for the $Creds variable to where you saved the credentials file for the email server.
You must also change the $From and $To variables to real email addresses (and $SmtpServer and $Port if you don't intend to use Glesys's email service).
Manual test run
Since the SYSTEM account owns the credentials file, you have to run any tests of the script from a PowerShell session started by the SYSTEM account. Execute the psexec64.exe command as before to launch a new PowerShell session:
Now, in the newly opened Terminal window, test the script:
To also test the email function, uncomment the test code by removing the # in front of $status (the line with the text "Uncomment to test the email function"):
Run the script again:
You should now receive an email, which includes the complete JSON output from the command.
Don't forget to comment out the test code once you have verified that the email is working, by putting a # in front of the line again, like so:
Schedule the script
The final piece of the puzzle is to schedule the script so it runs every day.
Start the Task Scheduler by clicking the Start menu and searching for task scheduler. Once it appears, click on it.

In the Task Scheduler, click Create Basic Task...

When the guide starts, give the new task a name, such as RAID check. Then, click Next.

Select to trigger the task Daily. Click Next.

Make sure that the task is set to recur every 1 day. Click Next.

Select Start a program and click Next.

Now you need to enter the program to execute.
In the Program/script field, type
powershell.exeIn the Add arguments field, type
-NonInteractive -File "C:\Users\Administrator\raidcheck.ps1"(but change the path if you have saved the script somewhere else).
Then, click Next.

You are going to need to tweak the task a bit, so select Open the Properties dialog for this task when I click Finish. Then, click Finish.

Click Change User or Group...

First, type SYSTEM in the text field. Then, click Check Names. SYSTEM will now become underlined in the text field. Finally, click OK.

In the properties dialog, it should now say NT AUTHORITY/SYSTEM to the left of the Change Users and Groups button. If so, save the new task by clicking OK.

The task is now scheduled to run every day.
Enabling history (optional)
If you would like to view the history of each run, you can enable it by clicking Enable All Tasks History. However, this is optional and not needed for the task to run. But it can be helpful for troubleshooting.

Notes
We recommend that you test the script to ensure that it truly works before putting it into live operation. There's no guarantee it will suit your specific server and setup.
Last updated
Was this helpful?