This script implements the following features:
•Generate a report of phone security settings
•Merge report from multiple CUCM servers into one report and prepend CUCM IP in first column
•Send a notification email with generated report as attachment.
REM UPLINX Report Tool - Example 1.3 - Generate CUCM Report for phone security settings REM PLEASE NOTE THAT THIS SCRIPT IS NOT SUPPORTED and provided as is. We provide custom scripting - please contact us with your detailed specification to provide a quote.
@echo on setlocal EnableDelayedExpansion echo %DATE% %TIME%
REM PFAD zu Files set p=c:\mytemp\ REM Name des Files set outcsv=%p%out.csv del /S /Q /F %outcsv%
REM Hier alle CUCM auflisten - erster muss /csvheader haben echo *** CUCM110 **** call :DoCSV 10.5.1.120 /csvheader
echo *** CUCM15 **** call :DoCSV 10.5.1.15
REM EMAIL set body="Phones Security settings at %DATE% %TIME%" "C:\Backup\mailsend.exe" -to toemail@company.com -from fromemail@company.com -port 25 -smtp smtpserver.company.com -sub "Phones Security settings" -M %body% -attach %outcsv%
echo *** Finished ALL at %DATE% %TIME% **** exit /b 0 goto:eof
REM === DoCSV Procedure === :DoCSV echo *** DoCSV CUCM:%1 append:%2 at %DATE% %TIME% *** REM Params passed in set ip=%1 set append=%2 set sqlcmd="select '%1' as CUCM, d.name,typemodel.name as model, NumPlan.dnorpattern as extension, d.description, sp.name as SecurityProfile, cs.name as CertificateStatus, co.name as CertificateOperation, eu.userid as owner,ka.name as keyauth, am.name as authmode, typekeyorder.name as keyorder, typekeysize.name as rsakeysize, typeeckeysize.name as eckeysize from device as d LEFT OUTER JOIN securityprofile as sp ON d.fksecurityprofile=sp.pkid LEFT OUTER JOIN typecertificatestatus as cs ON d.tkcertificatestatus=cs.enum LEFT OUTER JOIN typecertificateoperation as co ON d.tkcertificateoperation=co.enum LEFT OUTER JOIN typekeyauthority as ka ON d.tkkeyauthority=ka.enum LEFT OUTER JOIN typeauthenticationmode as am on sp.tkauthenticationmode=am.enum LEFT OUTER JOIN typekeyorder on sp.tkkeyorder=typekeyorder.enum LEFT OUTER JOIN typekeysize on sp.tkkeysize=typekeysize.enum LEFT OUTER JOIN typeeckeysize on sp.tkeckeysize=typeeckeysize.enum LEFT OUTER JOIN enduser as eu ON d.fkenduser=eu.pkid LEFT OUTER JOIN DeviceNumPlanMap ON d.pkid = DeviceNumPlanMap.fkDevice LEFT OUTER JOIN typemodel ON typemodel.enum = d.tkmodel LEFT OUTER JOIN NumPlan ON DeviceNumPlanMap.fkNumPlan = NumPlan.pkid WHERE DeviceNumPlanMap.NumPlanIndex = '1' AND d.tkclass=1 ORDER BY typemodel.name, d.name"
setlocal EnableDelayedExpansion "C:\Program Files\UPLINX Report Tool\ReportTool.exe" /cucm_ip !ip! /cucm_user admin /cucm_password "bla,123" /sql !sqlcmd! /csvfile %p%!ip!.csv !append! REM Add to mainfile type %p%%1.csv >> %outcsv%
goto:eof
|