Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO OFF
- TITLE Dell Hardware Email Alert
- ECHO Dell Hardware Email Alert
- ECHO Reddit
- ECHO.
- ECHO.
- REM Sends email alerts when Dell hardware warnings are triggered.
- REM This script should _not_ be in a path which contains spaces.
- REM
- REM Usage:
- REM DellAlert {/SETUP | Alert message}
- REM /SETUP Configure Dell Server Assistant to use this script for alerts.
- REM Alert Message
- REM Message to send.
- REM
- REM Requires:
- REM Blat : (command line emailer) is configured and working on the current system.
- REM If your email server requires authentication to relay, see comments below.
- REM Email address(es) to send alerts to (comma separated)
- SET ToEmail=myaddress@email.com
- SETLOCAL EnableExtensions
- IF /I {%1}=={/SETUP} GOTO Setup
- IF NOT {%1}=={} GOTO Alert
- GOTO End
- :Alert
- SET Log="%TEMP%DellAlert.txt"
- DATE /T > %Log%
- TIME /T >> %Log%
- ECHO Dell Alert Tripped! >> %Log%
- ECHO %* >> %Log%
- REM If your email server requires autentication to relay,
- REM add the following to the end of the line below:
- REM -u UserName -pw Password
- BLAT %Log% -to %ToEmail% -subject "%ComputerName% Hardware Alert"
- IF EXIST %Log% DEL /F /Q %Log%
- GOTO End
- :Setup
- ECHO This will replace all the current Dell Server Assistant alerts with a call
- ECHO to this script. To confirm you want to continue, enter YES (case sensitive).
- SET /P Confirm=
- IF NOT {%Confirm%}=={YES} GOTO End
- SET ScriptPath=%~dpnx0
- ECHO Configuring alerts to use: %ScriptPath%
- omconfig system alertaction event=powersupply execappath="%ScriptPath% power supply failure"
- omconfig system alertaction event=powersupplywarn execappath="%ScriptPath% power supply warning"
- omconfig system alertaction event=tempwarn execappath="%ScriptPath% temperature warning"
- omconfig system alertaction event=tempfail execappath="%ScriptPath% temperature failure"
- omconfig system alertaction event=fanwarn execappath="%ScriptPath% fan speed warning"
- omconfig system alertaction event=fanfail execappath="%ScriptPath% fan speed failure"
- omconfig system alertaction event=voltwarn execappath="%ScriptPath% voltage warning"
- omconfig system alertaction event=voltfail execappath="%ScriptPath% voltage failure"
- omconfig system alertaction event=intrusion execappath="%ScriptPath% chassis intrusion"
- omconfig system alertaction event=redundegrad execappath="%ScriptPath% redundancy degraded"
- omconfig system alertaction event=redunlost execappath="%ScriptPath% redundancy lost"
- omconfig system alertaction event=memprefail execappath="%ScriptPath% memory pre-failure"
- omconfig system alertaction event=memfail execappath="%ScriptPath% memory failure"
- omconfig system alertaction event=hardwarelogwarn execappath="%ScriptPath% hardware log warning"
- omconfig system alertaction event=hardwarelogfull execappath="%ScriptPath% hardware log full"
- omconfig system alertaction event=processorwarn execappath="%ScriptPath% processor warning"
- omconfig system alertaction event=processorfail execappath="%ScriptPath% processor failure"
- omconfig system alertaction event=watchdogasr execappath="%ScriptPath% watchdog asr"
- omconfig system alertaction event=batterywarn execappath="%ScriptPath% battery warning"
- omconfig system alertaction event=batteryfail execappath="%ScriptPath% battery failure"
- omconfig system alertaction event=systempowerwarn execappath="%ScriptPath% system power warning"
- omconfig system alertaction event=systempowerfail execappath="%ScriptPath% system power failure"
- omconfig system alertaction event=storagesyswarn execappath="%ScriptPath% storage system warning"
- omconfig system alertaction event=storagesysfail execappath="%ScriptPath% storage system failure"
- omconfig system alertaction event=storagectrlwarn execappath="%ScriptPath% storage controller warning"
- omconfig system alertaction event=storagectrlfail execappath="%ScriptPath% storage controller failure"
- omconfig system alertaction event=pdiskwarn execappath="%ScriptPath% physical disk warning"
- omconfig system alertaction event=pdiskfail execappath="%ScriptPath% physical disk failure"
- omconfig system alertaction event=vdiskwarn execappath="%ScriptPath% virtual disk warning"
- omconfig system alertaction event=vdiskfail execappath="%ScriptPath% virtual disk failure"
- omconfig system alertaction event=enclosurewarn execappath="%ScriptPath% enclosure warning"
- omconfig system alertaction event=enclosurefail execappath="%ScriptPath% enclosure failure"
- omconfig system alertaction event=storagectrlbatterywarn execappath="%ScriptPath% storage controller battery warning"
- omconfig system alertaction event=storagectrlbatteryfail execappath="%ScriptPath% storage controller battery failure"
- ECHO.
- ECHO Sending sample alert to:
- ECHO %ToEmail%
- CALL :Alert Testing Dell hardware alert warnings...
- ECHO.
- PAUSE
- GOTO End
- :End
- ENDLOCAL
- Script Mo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement