Enable Services

I need to be able to write a batch file that will stop a service.  I know the ip addresses but I don't know how to write this into a batch file.  I need to be able to start and stop this service weekly on all computers and where it is a workgroup, I cannot do so through a gpo.  Workstations are XP

I have started this:

@ECHO OFF

::disable SEP Client Service

::Run Program

call "C:\Program Files (x86)\Symantec\Symantec Endpoint Protection\12.1.XXXX.XXX\Bin"

smc -stop

::Run Program

call "C:\Program Files (x86)\Symantec\Symantec Endpoint Protection\12.1.XXXX.XXX\Bin"

::enable SEP Client Service

smc -start
KRS12Asked:
Who is Participating?
 
KRS12Author Commented:
Can I still call the path?  

@ECHO OFF

::disable SEP Client Service

SC [\\10.10.10.10] [stop] [smc]

::Run Program

::call "C:\Program Files (x86)\Symantec\Symantec Endpoint Protection\12.1.XXXX.XXX\Bin"
0
 
Tom CieslikIT EngineerCommented:
NET STOP SERVICENAME

NET START SERVICENAME
0
 
Bill PrewCommented:
Take a look at the SC command.

SC


»bp
1
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
KRS12Author Commented:
I think the sc command is perfect, but how can I include an ip scope for all the computers?  Rather than list one computer at a time?
SC [\\server] [command] [service_name] [Options]
0
 
Bill PrewCommented:
You can't, you will have to loop over all IPs.


»bp
0
 
Bill PrewCommented:
If you are wanting to execute that Bin file on the local machine, then yes.  If you are trying to execute it on the remote machine, then that won;t work.  And should you be calling an EXE, nit the BIN folder?  Or is BIN.EXE a program?

If you want to perform actions on every PC you might want to look at PSEXEC, it can allow running programs remotely, if your environment is set up properly.  Or perhaps consider Powershell...



»bp
0
 
KRS12Author Commented:
I cannot use PsExec for this task, it is not installed and I cannot install this due to policy.  I have to find a way to stop the services on every computer.  I have a mixed network.  Some computers are on a domain and some in a workgroup, but all are reaching from our server.  I can ping all the machines
0
 
KRS12Author Commented:
I have gotten this far:  

@ECHO OFF
cmd.exe /K ""%programfiles%\symantec\symantec endpoint protection\smc.exe" -stop
echo End of script.
pause

How can I run this on all computers, I am missing a line where I need to list the computer ip, ??
0
 
Bill PrewCommented:
It feels like you got some value form the expert comments on this question, did you not feel any were worthy of selecting as Solution or Assist?  Or were none useful?


»bp
0
 
KRS12Author Commented:
I tested this solution and it worked perfectly despite having  loop all ip addresses.  Thank you
0
 
Bill PrewCommented:
So, no comments from the experts were at all useful in getting you to that solution ???


»bp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.