Dell Openmanage Server Administrator E-Mail Alerts – Powershell & VBScript versions
ByLast year I posted a script written in VBScript which enables email alerts from Dell OMSA without the need for IT Assistant. This script has proved to be very popular, but a number of users have not been able to make it work because it depends on CDO, which is not included in Windows Server Core.
So, I have rewritten the script in Powershell and it should now work on any system which has Powershell installed. The new script is easier to read and includes support for SMTP over SSL, making the use of a Gmail account for sending the alerts very straightforward.
The whole process is very similar to the previous script, so if you used that one, this will be immediatly familiar.
Installation:
After you have downloaded the Zip file extract it to a folder on your server, e.g “C:\Script”
You will then need to edit the variables at the top of the script to make them appropriate for your environment:
If you do not specify an SMTPServer, it will default to localhost. If you do not specify an SMTPPort it will default to port 25.
If you intend to use the script with a gmail account set:
$SMTPServer = “smtp.gmail.com”
$SMTPUser = Your gmail account name (without the @gmail.com part).
$SMTPPassword = Your gmail account password
$SMTPPort = 587
$EnableSSL = true
Test Email is functional
Now that you have the script installed open up a powershell prompt and run the script with the “testemail” parameter e.g:
c:\script\dellalerts.ps1 testemail
If everything is working properly you should receive a test alert in your inbox.
Setup Alerts from OpenManage
Once the email function has been tested you can go ahead and setup the script to run from open manage, simply run the script again with the “setup” parameter, and you should see something like this:
Testing
There are a few easy ways to test the script in practice with a real alert generated by OpenManage:
- Pop the side off the server casing, this will generate a chassis intrusion alert.
- If you have a dual powersupply system you can pull the power to one of the supplies and the server should report the power loss.
The problem with these methods is that you have to be in the same place as the server. So I prefer to trigger a tempreture alert like this:
Just set the warning threshold to be a couple of degrees lower than your current reading. Warning: If you have a thermal shutdown action configured, this could trigger that process off and shutdown your server. Once you have received your test emails, set the tempreture wanrings back to default values.
Please let me know of any issues you have with the script and I will work on them as soon as possible. I have installed this updated version on a number of systems and it is working well.
The download includes both the new version and the older VBScript version.



[...] http://www.tachytelic.net/2011/09/dell-openmanage-server-administrator-e-mail-alerts-updated-powersh... [...]
Works perfectly with OMSA 6.3 on a PE T110 server.
Thanks very much!!!
I purchased and installed your Powershell scripts on Server 2008r2. Everything seems to work but no alerts from OpenManaage.
I set the temp alert and a warning is being generated.
The command in the temp warning setup does not send an email if I copy and paste it into PowerShell
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy unrestricted C:\script\DELLAL~1.PS1 email 2
But if I change email 2 to testemail, an email is send to my account.
Please let me know if you need further info.
Thanks
Thanks for the quick response to my issue.
We found the problem to be the spam filter on gmail was blocking the test email when the warning message was in the subject line.
I remove the spam tag from the emaill address and everything works fine.
This works great. Thank you for doing what Dell should have done.
Great Script!
To enable reporting to multiple emails, just add another mail to variable to the script IE: $Emailto2 and then add another line to add that variable to the email’s to section. IE: $MailMessage.to.add($EmailTo2). And that’s it, just add as many of those as you like for multiple recipients.
What are the parameters when your SMTP server does not require a user/password, i.e. anonymous
Nothing, just leave them empty.
For multiple e-mails, you can also just comma separate them, like person1@email.com, person2@email.com, person3@email.com
On a T310 Dell OpenManage Server Administrator Version 6.5.0
the testemail works – from the powershell line – but none of the events I trigger work..
What version of Powershell do you have installed? I have it running on an R310 and it works fine.
The version we bought Friday – Nov 18.
sorry – my bad – powershell 1 – - dellalert from Friday
Hi! I have the same issue as John (OSA 6.5) – works fine from commandline but triggered events dont work – running on Hyper-V R2 with all updates applied.
Do you have Powershell V2 installed though?
Hi
Thanks for the quick reply! – I wasnt sure so ran:
start /w ocsetup NetFx2-ServerCore
start /w ocsetup MicrosoftWindowsPowerShell
& rebooted.
Still no luck with OpenManage triggering the alert script, but if I copy & paste the alert command line from OpenManage onto the server’s command prompt it works fine.
Yes 2 is installed
PS C:\Users\Acronym> $PSVersionTable
Name Value
—- —–
CLRVersion 2.0.50727.5448
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
I can change the alert command line to say
C:\Windows\System32\cmd.exe
and on taskmanager watch the process be spawned when I change the alert threshold so it goes into warning status on the temperature monitor, so it must be in the syntax of the alert commandline.
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy unrestricted C:\Scripts\Alert.ps1 email 2
This is on Hyper-V Server R2 with SP1 btw
Also tried the VBScript version since we cant get the powershell version to execute, “cscript DellAlert.vbs testemail” errors with:
C:\Program Files (x86)\Dell\SysMgt\scripts\DellAlert.vbs(91, 3) Microsoft VBScript runtime error: ActiveX component can’t create object: ‘CDO.Message’
Hooray! Resolved the issue on Hyper-V R2
As OMSA runs in 32bit space, 32bit Powershell must also be installed:
Dism /online /enable-feature /featurename:MicrosoftWindowsPowerShell-WOW64
Thanks!
Well done, that is very useful to know!
VBScript version will definatley not work on Hyper-V R2 as CDO is not available and it is the primary reason that I wrote the powershell version.
Hi Paulie,
Just bought your script, but can’t get it to send even test mail.
Changed execution policy to unrestricted, tried different email accounts, but looks like the problem is somewhere else. Can you help me with that?
If you can’t get the test to work then you have your mail settings wrong. Simple as that really. Are you using the VBScript version or the powershell?
What OS? What mail server?
I’m using powershell version. OS – MS server 2008R2x64. Tried different mail servers: gmail, goDaddy hosted company mail.
I used your directions:
$EmailFrom = “myemail@gmail.com”
$EmailTo = “email addr i’m sending to”
$SMTPServer = “smtp.gmail.com”
$SMTPPort = “587″
$SMTPUser = “my login without @gmail.com”
$SMTPPassword = “my password”
$EnableSSL = $true
Please advise if I got something wrong. Thanks.
This script is fantastic! You could charge double, it’d still be a steal!
I use it with my small IT consulting side business. My customers LOVE that I know there’s an issue before they do.
One note: I use a Google Apps email account. For $SMTPUser, I entered the FULL email address of the account I was using. (ie, someone@somedomain.com)
Thanks again!
I have a T310 running with Windows SBS 2008. Test-Email worked, but OMSA did not want to send the alarmmails after setup like explained above. I tried the scriptpath manually which was put into OMSA by the setupscript and received an error Message:
C:\>C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -executuinpolicy unrestricted C:\dellalert.ps1 email 3
“Fehlender Ausdruck nach dem unären Operator “-”.
Bei Zeile:1 Zeichen:2
+ -e <<<< xecutionpolicy unrestricted C:\dellalert.ps1 email 3
Obviously that is a syntax error. To make it run, the syntax has to be this way:
C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe set-executuinpolicy unrestricted; C:\dellalert.ps1 email 3
I did not want to put the right syntax into all the configured alarms in the OMSA manually, so I had to change the script a little. The change has to be done in the function "SetDellAlert" as following.
function SetDellAlert
{
Param($DellEvent, $DellEventDescription, $EventID)
$omsacommand = "omconfig system alertaction event=$DellEvent execappath=`"$powershellpath set-executionpolicy unrestricted; $scriptpath email $EventID`” ”
“Configuring Alert: $DellEvent ($DellEventDescription)”
Invoke-Expression $omsacommand
}
I ran the setup again after the change, and now it works smoothly.
I hope this helps. Thank you for your script anyway, Paulie!
Well, now I made a syntax error myself
*To make it run, the syntax has to be this way:
C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe set-executionpolicy unrestricted; C:\dellalert.ps1 email 3
Using PS version acquired 12/12/2011 on 2K8 r2 enterprise
Test email works
Manaully executing applciation command works (e.g. C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy unrestricted C:\Dell\ALERTS~1\DELLAL~1.PS1 email 2) – (does require me to R the script to allow it to run)
But with a ‘lit’ tempertature probe alert as per instructions, I’m not getting any automated alert?
Update: What worked for me was to change the script to read:
`”$powershellpath -executionpolicy bypass $scriptpath email $EventID
changign the execution policy allowed emails to be sent.
Richard – that is interesting. I will check out the bypass option and may change it to be the default.
Friedrich – I know that the syntax of the command seems wrong when you see it in OMSA, but when OMSA executes it is ends up being correct. It deals with quotation marks in a very strange way, but does work for most people in the way that the script is written. You can tell by allowing the OMSA process to interact with the desktop. It is the easiest way to troubleshoot it actualy.
Great script! I was trying to do something similar as powershell is easy to me, but I could NOT get the right syntax for the damn OpenManage application execution!
So basically I bought your script just for that, but it is a nice script so I ended up using it anyway….
Good work!
I had the same problem. The syntax for the openmanage command within powershell took me ages to get right. Longer than writing the whole script!
I had the exact same situation as Richard and changing the execution policy to bypass worked for me as well.
Bought the script half hour ago. And now it works!
Next time I’ll need maybe 5min with testing.
Thank you Paul!
I have installe dhte latest powershell script and when i send a test email it works fine but i have unplugged one of the power cords to test the alert and i get no email I have checked on open manage and the warning is there and the snmp is setup can you help
Try changing the powershell execution policy to unrestricted.
Sorted