Search code examples
windowsbatch-filersyncms-security-essentials

Turning off Microsoft Security Essentials from a backup script


I have a small dos bat file I'm running to rsync a bunch of data, using cwRsync, over to a USB drive on a regular basis so I can migrate when replacement parts arrive without worry. I've noticed that MsMpEng.exe kills the transfer speed so I'm looking to turn off MSE's real time protection before the rsync, and back on immediately afterwards.

Is there any way to do this? Kill the task, flick something in the registry then remove it or via the Sc command? I notice that MsMpEng.exe doesn't have the facility, and I appreciate that this wouldn't be something easy as a malicious script could do it just as well if running as Administrator.

I am running the .bat file as Administrator already so that's not a problem. The script is pretty much this:

@ECHO OFF

SETLOCAL
SET CWRSYNCHOME="c:\Program Files (x86)\cwRsync"
SET CYGWIN=nontsec
SET HOME=%HOMEDRIVE%%HOMEPATH%
SET CWOLDPATH=%PATH%
SET PATH=%CWRSYNCHOME%\BIN;%PATH%

rsync --delete -rvP /cygdrive/d/games /cygdrive/f/
REM --SNIP--

If I can figure that out I may well use this in preference to windows backup for ever more.


Solution

  • You could try net stop nameofservice, though that only stops a single service at a time. If MSSE has multiple services and they watchdog each other, you may not be able to stop them all before the surviving ones start up the early victims again.