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
The PS script is working, but when I test it by opening the server case and setting off the intrusion alert I only get an “alert” email and not an “intrusion” alert email. What do I need to adjust in the script? Thanks in advance!
Disregard my last email…I figured it out – I had altered the email subject “ALERTDETAIL”.
Great script…thanks for the help!!
I would like to embed a link to the OMSA site in the body of the alert email. Can somebody share some insight on how to do this in powershell & also in VBScript?
Thanks in advance!!
Made a purchase, should I be getting a download link via e-mail or something?
Thanks, got the download. Had to play around a little with the script for a Dell T110 running OMSA 6.5
Richard’s solution worked for me:
Change:
function SetDellAlert
{
Param($DellEvent, $DellEventDescription, $EventID)
$omsacommand = “omconfig system alertaction event=$DellEvent execappath=`”$powershellpath -executionpolicy unrestricted $scriptpath email $EventID`” ”
“Configuring Alert: $DellEvent ($DellEventDescription)”
Invoke-Expression $omsacommand
}
to:
function SetDellAlert
{
Param($DellEvent, $DellEventDescription, $EventID)
$omsacommand = “omconfig system alertaction event=$DellEvent execappath=`”$powershellpath executionpolicy bypass $scriptpath email $EventID`” ”
“Configuring Alert: $DellEvent ($DellEventDescription)”
Invoke-Expression $omsacommand
}
i purchased the script about a month ago and it worked. now for some reason it doesnt work when i try to send the test email. now i get this:
Exception calling “Send” with “1″ argument(s): “The operation has times out.”
At C:\script\dellemail\powershell\dellalert.ps1:50 Char:18
+ $MailClient.Send<<<< (@MailMessage)
+CategoryInfo :NotSpecified: (:) [], MethodInvocationException
+FullyQualifiedErrorld : DotNetMethodException
NEED HELP!!!
scratch that! I figured it out.
But the script doesn’t seem to send an alert when you plug a USB drive into the server. It sends an alert for the temperature. But now I am a bit concerned if all the alerts work or not. Any feedback would help. Thanks!
Very simple – there is no alert generated when connecting or disconnecting a USB drive, because Dell Openmanage does not generate one for this event. It’s never been an option as far as I am aware, so not sure why you are expecting it.
The updated version of openmanage has it as an option.
OK, did not know that, I will check it out. The script will need to be changed to reflect the updated option.
Thanks! The updated openmanage changes from a blue sidebar to black and has some updated features.
OK. I am completed stumped.
If I run c:\script\dellal~1.ps1 email 17 from within powershell (32) or (64) it works fine and I get the email.
If I run C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -executionpolicy Unrestricted C:\script\DELLAL~1.PS1 email 17 from command prompt the email tries to go out but I see an error on the email server of Socket error sending response to DATA. Winsock error 10054 connection reset from the other side.
I do not get it. It works perfect from within powershell but not from command prompt.
Any ideas?
Got it working fine with VBScript version. Not sure why it will not work with powershell but it does not matter as long as one way works.
I’m new to using powershell, I’m getting this error:
The term ‘d:\script\dellalerts.ps1′ is not recognized as the name of a cmdlet, function, script file, or operable progr
am. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:25
+ d:\script\dellalerts.ps1 <<<< testemail
+ CategoryInfo : ObjectNotFound: (d:\script\dellalerts.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Matt,
Are you running that within powershell itself and not a command prompt? It looks like that is a command prompt response.
Running within powershell:
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\Administrator> d:\script\dellalerts.ps1 testemail
The term ‘d:\script\dellalerts.ps1′ is not recognized as the name of a cmdlet, function, script file, or operable progr
am. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:25
+ d:\script\dellalerts.ps1 <<<< testemail
+ CategoryInfo : ObjectNotFound: (d:\script\dellalerts.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Matt,
Yep. That is within Powershell allright. Try going to the directory and run dellalerts.ps1 testemail.
d:
cd script
dir (make sure the file dellalerts.ps1 is listed)
dellalerts.ps1 testemail
It should run it as long as it is there.
I got it working. I pulled a power supply and received the alert. I did not receive a recovery notification, are those not sent?
I a actually two new to the process to answer that question. I do not think so though.
Abolutely brilliant. I had been looking at so many different options which would basically give me this. All were either too expensive, too time-consuming, or both. And here I got the answer for £2.95!! I have to say how impressed i am at being able to write this thing so well (at all). I have no idea how you managed to manipulate/code OpenManage to do this, but well done! Really makes me want to master powershell scripting! Once again, “brilliant!”
Mike,
Thank you for your kind words, that is probably the nicest comment I have had to date.
Powershell is great and well worth taking the time to learn. Personally I still find unix shell scripting easier and more powerful, but that may be because I don’t yet know enough about Powershell.
In either case, learning one or the other will help you to understand both, as in my opinion they are very similar. I had to learn almost nothing new to write this script in PowerShell.
Thanks again
Paul
Paulie,
Purchased the script, got both PS and VB versions working on the respective servers, but is there a way to limit or state how many alerts will be sent out. Our mailboxes got flooded when we had a hard drive failure, great that it works but not so great we received almost 200 emails about the same problem.
I have considered adding some code that limits the amount of emails that are sent out. Unfortunatley the script sends a message everytime Openmanage generates the alert, which for some servers seems to be quite a reasonable rate and for others sends many for the same problem.
Have you tried updating to the latest version of Openmanage? What version are you running right now?
paulie
have you updated the script so it detects and sends an alert if a usb drive is plugged in?
Currently running version 6.5.0
I have not updated it yet. I will do it this week, it will only take a few minutes. Just been really busy. I will put the latest version of OpenManage on to one of my machines and check out the new options and then post the required code.
I thought that was already done with this piece of the code:
…
“removableflashmediapresent|Removable flash media present”, “removableflashmediaremoved|Removable flash media removed”, “removableflashmediafail|Removable flash media
…
I am using OM v7.0.0, but I do not get alerts inserting or removing a USB flash drive.
(Using PowerShell script)
Devin, how did you resolve the error?
Exception calling “Send” with “1″ argument(s): “The operation has times out.”
At C:\script\dellemail\powershell\dellalert.ps1:50 Char:18
+ $MailClient.Send<<<< (@MailMessage)
+CategoryInfo :NotSpecified: (:) [], MethodInvocationException
+FullyQualifiedErrorld : DotNetMethodException
Adam
I honestly don’t remember exactly what I did. But I think it had to do with the smtp port and ssl settings in the script. I hope that helps.
Paulie,
This script seems to work great, it’s sent me quite a few alerts from different versions of OMSA.
The other day I had an email from a server running OMSA 5.5.0 to say a disk had failed, but the server was not displaying an orange warning light.
Having looked at OMSA on it and a few of the servers, the ‘alert on console’ is not switched on anymore. Is it possible to have your scipt set this to ‘on’ when it’s run?
Sean.
I am having the same issue as other users when connecting to Gmail’s smtp server using the testemail parameter:
Exception calling “Send” with “1″ argument(s): “The operation has times out.”
At C:\script\dellemail\powershell\dellalert.ps1:50 Char:18
+ $MailClient.Send<<<< (@MailMessage)
+CategoryInfo :NotSpecified: (:) [], MethodInvocationException
+FullyQualifiedErrorld : DotNetMethodException
When I use the ISP's email server to relay (port 25, no security required) it works fine. What am I missing? I have followed the instructions for Gmail as laid out and have tried umpteen variations without success.
Anyone have the solutions for this???
Thanks.
Issue solved!!
Password contained a “$” as the first character. Changed the password not to contain a “$” and it worked!
Hope that helps anyone else.