Forum Discussion
KevinA
16 years agoRetired GoTo Contributor
One2Many Script Repository
Welcome to the LogMeIn Central Script Repository!
What is it? A library of scripts to help you execute automated tasks and manage LogMeIn Pro² computers without having to access them manually. ...
- 8 years ago
https://github.com/knix15/LogMeIn-One2Many-Community-Scripts/
Scripts can be found here as well for better future organization.
DTConsulting
11 years agoNew Contributor
Here is something I put together to update MSE or Defender and then run a full scan and use SendEmail to email a log file. Most of the echo commands are for seeing the progress in the LMI logs. C:\Clevespace was the working directory where I keep the batch files and the SendEmail exe. I created a batch file and then called it using the 'Run a batch file or executable'. I also check for its existence before running the batch this way: IF EXIST C:\Clevespace\NameOfBatchFile.cmd C:\Clevespace\NameOfBatchFile.cmd
//Contents of Batch
@ECHO OFF ECHO( ECHO Running Anti-Virus scans. Do not close this window. ECHO Thank you, Clevespace ECHO( ECHO( ECHO Scanning process started for %COMPUTERNAME% ECHO( ECHO IF MSE not installed jump to end IF EXIST "%programfiles%\Microsoft Security Client\mpcmdrun.exe" ECHO MSE detected! IF EXIST "%programfiles%\Microsoft Security Client\mpcmdrun.exe" GOTO MSEscan IF EXIST "%programfiles%\Windows Defender\mpcmdrun.exe" ECHO Defender detected! IF EXIST "%programfiles%\Windows Defender\mpcmdrun.exe" GOTO DefenderScan GOTO NotInstalled :MSEscan ECHO( ECHO Run MSE Update and Scan ECHO( ECHO Updating MSE Signatures "%programfiles%\Microsoft Security Client\mpcmdrun.exe" -SignatureUpdate ECHO( ECHO Running MSE Full Scan: "%programfiles%\Microsoft Security Client\mpcmdrun.exe" -scan -scantype 2 ECHO( ECHO Copy MSE log file if it exists IF EXIST "C:\Users\AdminUSERNAMEHERE\AppData\Local\Temp\MPcmdRun.log" COPY "C:\Users\ADMINUSERNAMEHERE\AppData\Local\Temp\MPcmdRun.log" C:\Clevespace /y GOTO MSEemail :DefenderScan ECHO( ECHO Run Defender Update and Scan ECHO( ECHO Updating Defender Signatures "%programfiles%\Windows Defender\mpcmdrun.exe" -SignatureUpdate ECHO( ECHO Running Defender Full Scan "%programfiles%\Windows Defender\mpcmdrun.exe" -scan -scantype 2 ECHO( ECHO Copy Defender log file if it exists IF EXIST "C:\Users\ADMINUSERNAMEHERE\AppData\Local\Temp\MPcmdRun.log" COPY "C:\Users\ADMINUSERNAMEHERE\AppData\Local\Temp\MPcmdRun.log" C:\Clevespace /y GOTO Defenderemail :MSEemail ECHO( ECHO Email MSE log file if exists IF EXIST C:\Clevespace\MPcmdRun.log ( TYPE C:\Clevespace\MPcmdRun.log > C:\Clevespace\MPcmdRun.txt C:\Clevespace\sendemail -f FromEmail@Example.com -t SendToEmail@example.com -u MSE Scan results for: %COMPUTERNAME% -xu SMTPemail@example.com -xp PassWord -l C:\Clevespace\Email.log -o tls=yes -s smtp.EXAMPLE.com:587 -o message-file=C:\Clevespace\MPcmdRun.txt -a C:\Clevespace\MPcmdRun.log -q ECHO( ECHO MSE Log file sent on %DATE% at %TIME% from computer %COMPUTERNAME% ) ELSE ( C:\Clevespace\sendemail -f FromEmail@example.com -t SendToEmail@Example.com -u MSE Scan results for: %COMPUTERNAME% -xu SMTPemail@example.com -xp PassWord -l C:\Clevespace\Email.log -o tls=yes -s smtp.Example.com:587 -m MSE was run, but there is no log file. -q ECHO( ECHO MSE email with no log sent on %DATE% at %TIME% from computer %COMPUTERNAME% ) ECHO( ECHO End of scanning process EXIT :Defenderemail ECHO( ECHO Email Defender log file if exists IF EXIST C:\Clevespace\MPcmdRun.log ( TYPE C:\Clevespace\MPcmdRun.log > C:\Clevespace\MPcmdRun.txt C:\Clevespace\sendemail -f FromEmail@example.com -t SendToEmail@Example.com -u Defender Scan results for: %COMPUTERNAME% -xu SMTPemail@Example.com -xp PassWord -l C:\Clevespace\Email.log -o tls=yes -s smtp.Example.com:587 -o message-file=C:\Clevespace\MPcmdRun.txt -a C:\Clevespace\MPcmdRun.log -q ECHO( ECHO Defender Log file sent on %DATE% at %TIME% from computer %COMPUTERNAME% ) ELSE ( C:\Clevespace\sendemail -f FromEmail@Example.com -t SendToEmail@Example.com -u Defender Scan results for: %COMPUTERNAME% -xu SMTPemail@Example.com -xp PassWord -l C:\Clevespace\Email.log -o tls=yes -s smtp.Example.com:587 -m Defender was run, but there is no log file. -q ECHO( ECHO Defender email with no log sent on %DATE% at %TIME% from computer %COMPUTERNAME% ) ECHO( ECHO End of scanning process EXIT :NotInstalled ECHO( ECHO MSE or Defender are NOT Installed C:\Clevespace\sendemail -f FromEmail@Example.com -t SendToEmail@Example.com -u MSE OR DEFENDER NOT INSTALLED ON: %COMPUTERNAME% -xu SMTPemail@Example.com -xp PassWord -l C:\Clevespace\Email.log -o tls=yes -s smtp.Example.com:587 -m MS Security Essentials or Defender are not installed!!! -q ECHO( ECHO MSE Or Defender Not Installed and an email was sent on %DATE% at %TIME% from computer %COMPUTERNAME% ECHO( ECHO End of scanning process
//End of batch file