开发者

Turning off Microsoft Security Essentials from a backup script

开发者 https://www.devze.com 2023-02-08 05:43 出处:网络
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

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 开发者_JAVA百科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.


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.


You may not even need to tun the security essentials off. You can add "rsync.exe" to the exception program list and MSE will be much faster.

I noticed it using a ton of processor while rsync was transfering the moment I added rsync.exe to the exception list it dropped to 0% and rsync will speed up again.


I think you're looking for this info:

http://www.addictivetips.com/windows-tips/command-line-utility-mpcmdrun-exe-microsoft-security-essentials/

the security essentials do not normally allow themselves to be disabled from the command line - at best, you can run a scan, or an update.


Just to clarify as the comment I made to the accepted answer might be lost in the ether to future visitors.

It is quite simple to do if the script runs as administrator:

sc stop MsMpSvc
taskkill /f /im msmpeng.exe
rsync --delete -rvP /cygdrive/d/games/steam /cygdrive/f/games
sc start MsMpSvc

If you have other Security Essentials window/tasks open, for example by using the icon in the system tray, it may automagically restart the services. Depending on your system you may therefore need to taskkill other exes. There is only one main service for Security Essentials so starting that appears to restore all other systems.

Of course, on a lot of systems MSE doesn't interfere in any noticeable fashion but my hardware is currently suffering a serious problem and backups to the USB drive were being drastically slowed. In light of that it's entirely possible that these steps will be unnecessary on a new system.

0

精彩评论

暂无评论...
验证码 换一张
取 消