PDA

View Full Version : Need help with something like batch files trying to shut down M$ Security Essentials



Clint1
04-14-2012, 08:45 AM
I'm having a lot of problems trying to do the SIMPLEST thing and I'm hoping someone can put me in the right direction. I have ~a dozen batch files that I use to stop and start various XP Services, with no problem. (For example, there's no point in keeping the Spooler Service running all the time sucking up memory, so I have it set to Manual, then I click the Start batch file before I want to print something, then click its Stop batch file when I finished. Perfect).

So what's the problem in doing this with Microsoft Security Essentials and its anti-malware service???? First, the idiot program has no way of shutting it down, THAT is the problem! Obviously M$ believes that no one would ever have any reason to close it hence the lack of the simple right click System Tray icon and "Exit" or "Close"! The only way to shut it down is to open the Task Manager and click both "MsMpEng.exe" and "msseces.exe" and "End Process" for each. That just doesn't cut it.

Using the same batch file method for the SERVICE, MsMpEng.exe, "Microsoft Antimalware Service", DID work, ONCE. But every attempt after that failed with an "Access denied" message showing in the batch file command window! I've tried all of these, all at once and with the last 1 or 2 not there:

@echo Stopping unnecessary service...
@net stop Microsoft Antimalware Service
@net stop MsMpSvc
@net stop MsMpEng.exe

Then there's the problem with the app itself, which is NOT a Service, "msseces.exe". I can't find any way to shut it down via batch file.

However, "taskkill" does work for both of the running items! But it will only work after you click "Run" in the Start Menu and pasted the command line! You have to do it twice:

taskkill /f /im MsMpEng.exe

Then:

taskkill /f /im msseces.exe

So if that works, then why can't some kind of a one-click shortcut to those complete commands work? Why can't a batch file be created to do both tasks at the same time?

I read that one can 'allegedly' create a shortcut from the Run command. You can't. When I try and drag the Run icon in the Start Menu (as the webpage states), nothing happens! So I then found the cmd.exe file, and made a shortcut to that. Ok, but now what? Obviously when you click it, the only thing that happens is the cmd prompt window opens up waiting for the command line. How do I automatically POPULATE that line in it; "C:\WINDOWS\system32>", to EXECUTE the command lines I want? I tried modifying the shortcut's properties and that doesn't work:

C:\WINDOWS\system32\cmd.exe -taskkill /f /im MsMpEng.exe

...and several other variants, with and without quotes in various areas, etc.

So again, can anyone POH-LEEZE tell me how to shut down MSE, BOTH of those running processes, in ONE click? Via batch file, VBS script, Run command shortcut, etc, I don't care. Of course this would NOT be necessary if M$ would have simply added the right click and "Exit" for the System Tray icon.

Thanks.

Clint1
04-14-2012, 08:56 AM
Ho boy. This is what happens when you pull your hair out over something, and end up over-complicating it. Seconds after I posted that ^, I realized why not just simply use a shortcut to taskkill??? DUH.

I created two shortcuts to it, and edited the properties of each to read:

C:\WINDOWS\system32\taskkill.exe /f /im MsMpEng.exe

And:

C:\WINDOWS\system32\taskkill.exe /f /im msseces.exe

That works fine. So I now I need to find a way to incorporate both of those tasks into one click.

Now I noticed, that when I click the MSE icon to start it again, it won't start! The app starts, the interface opens up, but the frickin' Service won't start like it used to! You have to click that red button on it "Start Now", even though the Service is set to Automatic!

SteveGerencser
04-14-2012, 11:26 AM
Okay, this won't answer your question, but I will offer some advice to you anyway.

Don't do this. Windows XP was never designed to allow you to micro manage services like this. Every time you start and stop a service you really should be rebooting your system to make sure everything that is associated with that service, uses that service, or depends on that service, reconnects properly. Add to that, this type of starting/stopping can also introduce other issues to your system depending on which services you are killing and what else is running when you do it.

Taskkill was designed to terminate a specific task/service that was hanging up your system to allow you to remove it or reboot your system. It was not designed to be an on/off switch to save system resources.

The obvious answer is add more ram to your system, but I'm going to wager that that isn't an option.

Steve - former MCSE, CNE, A+, MCT and more. <- 15+ years or real hardware/software tech support

weegillis
04-14-2012, 02:50 PM
I would just add, if it was easy to kill an important system protection service, then malware would do it. It makes no sense to be able to reach in, and just kill a program with a simple batch file, especially MSE, or any other anti-malware. Most self-protect services have countermeasures to software manipulation.

What Steve advises, above, about messing up the system, not rebooting after changing services can result in changes to the registry that are both hard to detect, and that don't get removed or reset even when services are restored. The reboot is not an option, it is a requirement to ensure that the registry is properly updated and backed up.

deepsand
04-15-2012, 01:33 AM
The app starts, the interface opens up, but the frickin' Service won't start like it used to! You have to click that red button on it "Start Now", even though the Service is set to Automatic!
Because "Automatic" means that it's to be automatically started when Windows is launched.

weegillis
04-15-2012, 03:33 AM
Furthermore, self-protect services are 'assumed' to be there whence called up. Certain pointers in the registry simply point to locations that are expected to be 'alive', as in point to running services or processes. Shutting down these services while these pointers are in effect can have a negative effect on the hive as a whole, and may make any crash, however remote, unrecoverable.

Clint1
04-15-2012, 05:31 AM
Okay, this won't answer your question, but I will offer some advice to you anyway.

Don't do this. Windows XP was never designed to allow you to micro manage services like this. Every time you start and stop a service you really should be rebooting your system to make sure everything that is associated with that service, uses that service, or depends on that service, reconnects properly. Add to that, this type of starting/stopping can also introduce other issues to your system depending on which services you are killing and what else is running when you do it.
:confused: Of that I am fully aware, I didn't just start using PC's yesterday. Trying to close an anti-malware program--which as I said--can be done with any other anti malware program via the System Tray icon--is not "micro managing" anything. We are NOT talking about shutting down RPC, or Windows Management Instrumentation, etc., nor any other critical XP Service! We are talking about an anti-malware program......that (like all the others) not only has no business running in the background when one is trying to install or uninstall software, (and most installers even tell you to shut down this type of software while installing their programs), cannot be running when something like defrag'ing is done, but does not even need to be running and sucks up memory and resources when one is working with A/V creation and editing, and the like!

Since you want this to be about Services (and "micro-managing") : Windows Image Acquisition, the Print Spooler, and more than a dozen others, are nothing but resource and memory hogs that add up to a lot of wasted memory and resources! Such services of which I speak are NOT "mission critical" Services. Furthermore, they have no critical lower-tier dependencies ("associated with that service"). Keeping them on Manual does not affect any other (mandatory) Service. Otherwise, my PC would not properly work. (http://www.blackviper.com/windows-default-services/windows-xp-default-services/ , example: http://www.blackviper.com/windows-services/print-spooler/ : "I place this service into manual mode and only start it up when printing is required. In manual mode, the service will not automatically start at boot time. However, if you do a lot of printing, Automatic is the best bet for convenience.")

As I said, I have been doing this since shorty after XP came out, and, with absolutely no ill-effects.



Taskkill was designed to terminate a specific task/service that was hanging up your system to allow you to remove it or reboot your system. It was not designed to be an on/off switch to save system resources.
That's why I need a batch file to do it! But since people unwilling to help with that........



The obvious answer is add more ram to your system, but I'm going to wager that that isn't an option.
It already has the max amount of RAM seen by XP. (4gb, sees about 3.3gb, 3.4ghz overclocked CPU).

So your "advice" is to: spend ~$1000+ for a new PC and OS that will allow 8gb+ of RAM, and "micro managing", with a currently non-existing 6ghz CPU, just to shut down a frickin' anti-malware program that should have an "Exit" command just like all the others??

This is not about Services, this is not about criticizing how one uses, and chooses to use their PC, nor how one has been using their PC since shortly after the OS was released. This is simply about how to create a batch file (or similar), to shut down a frickin' program that has no business running at specific times. But due to the fact that everyone wants to turn this into something it is not, obviously I'll need to go elsewhere for assistance. :rolleyes: Which is precisely what you wanted since you have been most vocally opposed to a Software forum.

Thanks for the "help". Everyone.

Clint1
04-15-2012, 05:34 AM
Because "Automatic" means that it's to be automatically started when Windows is launched.
No....not necessarily. http://www.webproworld.com/webmaster-forum/threads/117411-How-do-you-get-MSE-Microsoft-Security-Essentials-to-load-at-startup?p=612009&viewfull=1#post612009 MSE will not load at startup for many people, even with it of course set to Automatic.

Clint1
04-15-2012, 06:13 AM
Since I like to help others when I can, if anyone else has a similar situation this is what I've done so far:

So far the only way I've found to stop "MsMpEng.exe" and "msseces.exe" (so I can successfully defragment, install/uninstall apps, video creation/editing, and RAM & resource intensive tasks, etc.), is to create two taskkill shortcuts; one for each. In the shortcut "Target" properties for each, are these:

1st: C:\WINDOWS\system32\taskkill.exe /f /im msseces.exe
2nd: C:\WINDOWS\system32\taskkill.exe /f /im MsMpEng.exe

They need to be clicked in that order or an MSE pop-up will appear.

*I have not yet found a way to incorporate both commands into one click.

Then to start MSE again when I need it, I changed the properties of the MSE app shortcut to point to a batch file:

@title MSE Manager
@echo Running MsMpSvc... Wait until it's done.
net start MsMpSvc
"C:\Program Files\Microsoft Security Client\msseces.exe"
@echo Stopping unnecessary service...
@net stop MsMpSvc

Or:

@title MSE Manager
@echo Running MsMpSvc... Wait until it's done.
net start MsMpSvc
"C:\Program Files\Microsoft Security Client\msseces.exe"

It starts again as before, the icon goes to the System Tray, but either way, *unlike all the other batch files I use in the exact same manner, the command window will not automatically close like the others! So I have to click to close it, and click to close the MSE main program window.

To change the shortcut icon for the new MSE shortcut back to the MSE icon, you click its Properties > Change icon > then browse to the MSE folder and select msseces.exe . To do the same thing for the taskkill shortcuts, I created a new icon using the default MSE icon but with a red X through it, and used those for both of the shortcuts, put those on the Quick Launch toolbar next to the MSE app (MSE batch file) icon.

No, your PC will not explode, implode, melt-down, nor become unstable in any way. As a matter of fact, it will be MORE STABLE when you do your resource and CPU-intensive tasks, defrag'ing, etc., because it will not be running and interfering with said tasks.

*If someone could assist with those areas, I'd appreciate it. But I won't hold my breath looking at the way this thread has gone so far.

DaveSawers
04-15-2012, 09:56 AM
Maybe I missed something in all the noise in this thread, but why can't you point your shutdown shortcut to a batch file that executes the two commands in order?

SteveGerencser
04-15-2012, 10:11 AM
So your "advice" is to: spend ~$1000+ for a new PC and OS that will allow 8gb+ of RAM, and "micro managing", with a currently non-existing 6ghz CPU, just to shut down a frickin' anti-malware program that should have an "Exit" command just like all the others??

Then use one of the others.

Clint1
04-15-2012, 11:15 AM
Maybe I missed something in all the noise in this thread, but why can't you point your shutdown shortcut to a batch file that executes the two commands in order?
That's exactly what I need to do! But, I don't know how, that's what I'm asking. ;)
Thanks.

Clint1
04-15-2012, 11:18 AM
Then use one of the others.
That would be a possible option, but I tried MSE, liked it (other than this issue), and it passed every test I threw at it. So it works great, no real reason to change. If I would not have found a way to shut it down, then I may have had to have tried something else.

deepsand
04-15-2012, 04:55 PM
Trying to close an anti-malware program--which as I said--can be done with any other anti malware program via the System Tray icon ...
Not so for all. For example, you cannot shut down AVG via either the Sys. Tray icon or Task Manager.

deepsand
04-15-2012, 04:59 PM
No....not necessarily. http://www.webproworld.com/webmaster-forum/threads/117411-How-do-you-get-MSE-Microsoft-Security-Essentials-to-load-at-startup?p=612009&viewfull=1#post612009 MSE will not load at startup for many people, even with it of course set to Automatic.
Nevertheless, "Automatic" is not intended to be of any effect re. user launched applications. That's what "Manual" is intended for.

SteveGerencser
04-15-2012, 05:33 PM
So it works great, no real reason to change.

Except it doesn't behave they way you want it to. You remind of my restaurant days.

Clint1
04-16-2012, 05:18 AM
Except it doesn't behave they way you want it to. You remind of my restaurant days.
You don't want to know of what you remind me:

"That would be a possible option, but I tried MSE, liked it (other than this issue), and it passed every test I threw at it. So it works great, no real reason to change. If I would not have found a way to shut it down, then I may have had to have tried something else."
http://www.webproworld.com/webmaster-forum/threads/117623-Need-help-with-something-like-batch-files-trying-to-shut-down-M-Security-Essentials?p=613191&viewfull=1#post613191

Now what does that state?? "....other than this issue."

You only choose to read what suits your own agenda. You are confrontational and argumentative, with a personal vendetta. Not desirable characteristics for a mod. I'm past the point of being fed up with it. Insults or condescending remarks--if you must--should be taken up in a PM.

Read a post, put aside your bias and personal hatred, and reply IF you can help. Otherwise your actions are not conducive to a positive, polite and friendly forum experience.

Thank you.

Clint1
04-16-2012, 05:33 AM
Not so for all. For example, you cannot shut down AVG via either the Sys. Tray icon or Task Manager.
I've been using Kaspersky for maybe ~8 years (then could no longer take the plethora bugs introduced with every update). Before that I tried Norton, McAfee, Trend, Panda, NOD, but I never tried AVG.

deepsand
04-16-2012, 06:07 AM
I'm a bit surprised that you're finding MSE to be a resource hog.

I've one machine, a Dell Optiplex 740 - the original, not the 740 Enhanced - w/ dual core AMD Athlon CPU & 2 GB RAM running XP SP3, on which waiting for the AVG boot scans in particular, and its use of resources in general, had become increasingly troublesome as it advanced from version to version. I replaced it with MSE, and got my old speedy machine back.

Clint1
04-16-2012, 06:53 AM
I'm a bit surprised that you're finding MSE to be a resource hog.

I've one machine, a Dell Optiplex 740 - the original, not the 740 Enhanced - w/ dual core AMD Athlon CPU & 2 GB RAM running XP SP3, on which waiting for the AVG boot scans in particular, and its use of resources in general, had become increasingly troublesome as it advanced from version to version. I replaced it with MSE, and got my old speedy machine back.
I never said it was a "resource hog". Like you, I've found that to be quite the contrary. KIS (would not only hijack everything I tried to do) but sucked up much more RAM, and pegged the CPU usage at 100% at times for absolutely no reason. ( :confused: ) MSE is far less intrusive, and uses much less RAM and CPU use (it's usually at 0% unless a scan is being done, then doesn't rise that much). Another thing I've found: I've seen complaints about MSE slowing boot times, but I haven't seen that. With KIS it took about '3 days' for the Desktop to "settle" and I was able to click anything. With MSE, there's no delay. However that doesn't change the fact that MSE must, or at the least should, be shut down during certain tasks (such as during the aforementioned times).

chrisJumbo
04-16-2012, 04:38 PM
Clint, I just put the two kill commands that you had above into a batch file, ran it and it killed both processes. Now the first time both stopped and then MsMpEng.exe restarted. I manually killed it after that. Then I re-started it and ran my kill.bat again. This time both stopped. So I'm not sure what allowed it to restart itself, but obviously it has some self-protection thing somewhere.

kill.bat


C:\WINDOWS\system32\taskkill.exe /f /im MsMpEng.exe
C:\WINDOWS\system32\taskkill.exe /f /im msseces.exe
Pause


Secondly, I don't think Steve was trying to be a pain with his first response, but as a moderator, I think he believes he needs to warn others who may be attempting things that they shouldn't. Anyway, I hate to see it when posts get nasty. I hope the above helps you.

BTW, I also restarted it again, but will probably re-boot. Also, there are programs that I will manually stop for similar reasons to Clint. I can't add anymore memory and it saves me enough to get through the day without getting the running out of virtual memory error and things do run smoother. I wouldn't suggest this for the uninitiated. :O)

deepsand
04-17-2012, 04:34 AM
Looking through your list of tasks with which you feel MSE interferes, there is but one that stands out as being perhaps affected by MSE, that of A/V creation and/or editing. Is the problem there one regarding MSE's usage of CPU or RAM?

Clint1
04-17-2012, 06:19 AM
Looking through your list of tasks with which you feel MSE interferes, there is but one that stands out as being perhaps affected by MSE, that of A/V creation and/or editing. Is the problem there one regarding MSE's usage of CPU or RAM?
(Also defrag'ing et al). To a point.....I don't have a dual, quad or 8-core CPU, it's just a HyperThreaded CPU. So even though it's 3.4ghz (2.4ghz 200/800mhz FSB o'clocked to 282/1100mhz+ bus), (plus the max dual-channel RAM & 10,000rpm VelociRaptor), it's not as good at multitasking as a little slower multi-core CPU. I do ~a dozen or more things at a time, with gobs of files and apps open, therefore the fewer Services or background apps/programs that don't need to be running at the time, the better.

Clint1
04-17-2012, 06:37 AM
Clint, I just put the two kill commands that you had above into a batch file, ran it and it killed both processes. Now the first time both stopped and then MsMpEng.exe restarted. I manually killed it after that. Then I re-started it and ran my kill.bat again. This time both stopped. So I'm not sure what allowed it to restart itself, but obviously it has some self-protection thing somewhere.
Nice, green coming your way. :mrgreen:

If you look under Services > Microsoft Antimalware Service > Properties > Recovery, those drop-downs need to be set to "Take no action". If they are set to Restart, I believe that's what's causing it to restart after the stop command.





C:\WINDOWS\system32\taskkill.exe /f /im MsMpEng.exe
C:\WINDOWS\system32\taskkill.exe /f /im msseces.exe
Pause

Works great, thanks a bunch. But how do you get the command window to automatically close once the tasks are completed? I believe there's a line that can be added at the end, but I don't know what that is.



Secondly, I don't think Steve was trying to be a pain with his first response, but as a moderator, I think he believes he needs to warn others who may be attempting things that they shouldn't.
It may appear that way to an "outsider" ( ;) ), but that has been going on with me for many years. So there is much more to the entire context of the story than just one post. The post could have been prefaced with any appropriate warnings (for newbies), which is totally fine, but then followed by the assistance sought (then it just got worse from there in subsequent posts (http://www.webproworld.com/webmaster-forum/threads/117623-Need-help-with-something-like-batch-files-trying-to-shut-down-M-Security-Essentials?p=613268&viewfull=1#post613268)). You are the first person, to actually help (and I appreciate that).



Anyway, I hate to see it when posts get nasty. I hope the above helps you.
Couldn't agree more, that's why I leave here for months on end. And; indeed it does, thanks again.



BTW, I also restarted it again, but will probably re-boot. Also, there are programs that I will manually stop for similar reasons to Clint. I can't add anymore memory and it saves me enough to get through the day without getting the running out of virtual memory error and things do run smoother. I wouldn't suggest this for the uninitiated. :O)
That's another reason why I do this (described in ^ prior post above), PageFile usage. The lower that "Commit charge" is kept (PF usage) shown in XP's Task Manager, the more stable the PC. (You may want to try changing the size of your PF/virtual memory).

Clint1
04-17-2012, 07:08 AM
Works great, thanks a bunch. But how do you get the command window to automatically close once the tasks are completed? I believe there's a line that can be added at the end, but I don't know what that is.
Ok I found out by just removing the "Pause" line at the end, I can click it, MSE totally shuts down, and the cmd window automatically closes. So it's working fine now.

But the problem still remains on how to get the START batch file's window to automatically close. :confused: This still works to start MSE again, but the cmd window remains open:

@title MSE Manager
@echo Running MsMpSvc... Wait until it's done.
net start MsMpSvc
"C:\Program Files\Microsoft Security Client\msseces.exe"

Clint1
04-17-2012, 07:20 AM
Contrary to what is said here, the simple "Exit" line doesn't work!

Exits out of the DOS window if the batch file is running from Windows.
Additional information and the syntax of this command in each version of Windows and MS-DOS can be found on our EXIT command page (http://www.computerhope.com/exithlp.htm).
And there's nothing on this "EXIT command page" other than "Exit"!

Clint1
04-17-2012, 09:15 AM
Contrary to what is said here, the simple "Exit" line doesn't work!

Exits out of the DOS window if the batch file is running from Windows.
Additional information and the syntax of this command in each version of Windows and MS-DOS can be found on our EXIT command page (http://www.computerhope.com/exithlp.htm).
And there's nothing on this "EXIT command page" other than "Exit"!
(Sorry again about all the dupe posts, couldn't help it. There really should be a way for us to delete our own posts).

I got this fixed. To start all of MSE, in one-click, and to have the cmd window automatically close, the batch file is:

@echo off
net start MsMpSvc
start "" "C:\Program Files\Microsoft Security Client\msseces.exe"
EXIT

I'm not sure the "EXIT" at the end does anything, but the key was the start "" area. I'm at a lost as to why that's not needed in any of my other batch files!

To stop all of MSE (thanks to Chris), and *to have the cmd window automatically close, the batch file is:

C:\WINDOWS\system32\taskkill.exe /f /im MsMpEng.exe
C:\WINDOWS\system32\taskkill.exe /f /im msseces.exe

*Had to remove the "Pause" at the end.

chrisJumbo
04-17-2012, 09:43 AM
In general, I have found that once a batch file is done it exits and goes away on its own. I had the "pause" statement so that I could see the results of each line as it was running. I'm glad we found a solution. Happy editing.

BTW, I do some simple movie making using my wife's Windows 7 PC and just use Windows movie maker. When I tried to use my Windows XP PC the program would crash all of the time. Since moving to my wife's, I haven't had any problems.

And blessings back to you. :O)

Clint1
04-17-2012, 10:45 AM
BTW, I do some simple movie making using my wife's Windows 7 PC and just use Windows movie maker. When I tried to use my Windows XP PC the program would crash all of the time. Since moving to my wife's, I haven't had any problems.
Maybe a thread on WMM, it's most buggy. I've found that the older version 2.1.4026.0 is better, more stable. With XP's SP's, I don't remember if it's SP2 or SP3, the moviemk.exe file changes to v2.1.4027.0 . You should be able to find the 4026 version in one of those $SPuninstall folders. You don't need to change any of the .dll files or the others, but I saved those too in case I might. Rename the 4027 version of moviemk.exe and keep them both in the same folder, because .mswmm files are not cross-compatible between versions. So if you edited a clip with 4027 and saved the .mswmm file, it will not open in 4026, but you can simply drag the v4027 .mswmm file to the renamed v4027 moviemk.exe file and it will open, you don't even have to rename it back.

chrisJumbo
04-17-2012, 12:11 PM
Thanks for the tip. I will have to check that out. :O)

weegillis
04-30-2012, 07:05 PM
This thread had a spin off discussion about Defrag, which has now been moved to a new thread, "Defrag Discussion (http://www.webproworld.com/webmaster-forum/threads/118219-Defrag-discussion)".