Link to home
Start Free TrialLog in
Avatar of KRS12
KRS12

asked on

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
Avatar of Tom Cieslik
Tom Cieslik
Flag of United States of America image

NET STOP SERVICENAME

NET START SERVICENAME
Avatar of Bill Prew
Bill Prew

Take a look at the SC command.

SC


»bp
Avatar of KRS12

ASKER

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]
You can't, you will have to loop over all IPs.


»bp
ASKER CERTIFIED SOLUTION
Avatar of KRS12
KRS12

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Avatar of KRS12

ASKER

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
Avatar of KRS12

ASKER

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, ??
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
Avatar of KRS12

ASKER

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


»bp