@echo off ::server to generate report for set SERVER=10.20.30.40 ::user has to have read access to Global/Health set USERNAME=health set PASSWORD=foobarbaz ::mail server to use set MAIL_SERVER=mail.example.com ::SMTP authentication (leave empty to not use) set MAIL_USER= set MAIL_PASS= ::e-mail sender and recipient(s) set MAIL_SENDER=report@example.org set MAIL_RECIPIENT=admin@example.net ::send report only if the following level is reached: 0=always, 1=unknown readings, 2=warnings, 3=errors set MAIL_LEVEL=1 ::use SSL/STARTTLS when sending e-mail set MAIL_SSL=1 ::path to VMWare vSphere CLI\bin directory set VCLI_BIN=%PROGRAMFILES(x86)%\VMware\VMware vSphere CLI\bin set PATH=%PATH%;%VCLI_BIN% if not [%MAIL_USER%]==[] set MAIL_USER=--mailuser %MAIL_USER% if not [%MAIL_PASS%]==[] set MAIL_PASS=--mailpass %MAIL_PASS% set SSL= if [%MAIL_SSL%]==[1] set SSL=--mailssl if [%PERL5LIB%]==[] set PERL5LIB=%VCLI_BIN:\bin=%\perl\lib perl "%~dp0\esxi_health_status.pl" --server %SERVER% --username %USERNAME% --password %PASSWORD% --mailserver %MAIL_SERVER% --sender %MAIL_SENDER% --recipient %MAIL_RECIPIENT% --mailhtml --maillevel %MAIL_LEVEL% %MAIL_USER% %MAIL_PASS% %SSL%