This PowerShell script will configure OMSA to send out emails when an alert is generated.
It will include the following:
- System information from
omreport chassis info
- Storage information from
omreport storage vdisk
- Attach the system alert log from
omreport system alertlog
This script is based on this script by Paul Murana.
- Place the
OMAlert.ps1
in a folder on your system, mine is underC:\Scripts\
. - Edit the variables under
$mailArgs
to match your settings:⚠️ It's best to use an encrypted file instead of a plaintext password in a script, the below is just a simple example.# Default mail arguments $mailArgs = @{ To = "example@example.com" From = "example@example.com" Credential = New-Object System.Management.Automation.PSCredential ("example@example.com", ("password" | ConvertTo-SecureString -AsPlainText -Force )) SmtpServer = "smtp.example.com" Port = "587" UseSsl = $true }
-
Execute the script with the param
configure
, this will both configure OMSA and create a bunch of .bat scripts in the same directory.These scripts are called by OMSA once an alert is generated.
PS C:\Scripts> .\OMAlert.ps1 configure Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. Alert action(s) configured successfully. PS C:\Scripts>
You can test if the script did it's job by temporarily lowering the Temperature Threshold
settings.
This should generate an alert and send out an email.
To clear all alert configurations, execute the script with the param clearall
.