View unanswered posts | View active topics It is currently 25 Oct 2014 12:11



Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Stopping services, restarting services(safemode) 
Author Message

Joined: 25 May 2012 12:34
Posts: 12
Post Re: Stopping services, restarting services(safemode)
Liviu,
That seem to work well.
I put some pauses in it so I can see it as it works. Is there a way to >> push the disabled ones into a text file, then start disabled.txt
I want to stop those currently running, and disable them from restarting. Of course I will need to list AV services as to not disable them, but if they are any good, they don't allow that (which is a test I want)

So currently this code only stops those stoppable but does it disable all those not in the list?
This is why I was shooting for just stopping and disabling anything not in the list. I wouldn't use this on computers with specialized services of course.
By the way, thank you for your help. Please understand, these are the services I would be turning off anyway, just more automated.


10 Aug 2012 11:17
Profile
Expert

Joined: 13 Jan 2012 21:24
Posts: 441
Post Re: Stopping services, restarting services(safemode)
crobertson wrote:
Is there a way to >> push the disabled ones into a text file
Assuming you mean "stopped" rather than "disabled", yes, all you need to do is add a line "if exist disabled.txt del disabled.txt" before the top for loop, then right after "net stop" insert a line "echo %svcex%>>disabled.txt".
crobertson wrote:
then start disabled.txt
Code:
for /f "delims=" %%x in (disabled.txt) do @echo net start "%%x"

crobertson wrote:
So currently this code only stops those stoppable but does it disable all those not in the list?
Only stops, the disabling part popped up later in the thread. If you really have to do that, lookup "sc config start=".

crobertson wrote:
Please understand, these are the services I would be turning off anyway, just more automated.
Just as a note, even the "turning off" part is not guaranteed to always work, and can't be made to work reliably using a simplistic batch+whitelist solution. For example, it is technically possible that the next millisecond after you "net stop" a service, another service which comes later in the alphabetical list (and has not been stopped yet) needs the first service and restarts it manually.

Liviu


10 Aug 2012 13:30
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2


Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Forum style by Vjacheslav Trushkin for Free Forums/DivisionCore.