Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command to remotely disable services......

Status
Not open for further replies.

RABOD

Technical User
Jan 25, 2003
37
0
0
GB
Hi all,

Hope someone can help with this query.

I help maintain a large amount of computers within a domain (6000 ish).
recently some software has been installed which has caused performance issues on some pcs.
We are currently one-by-one remoting to these pc's and disabling two services which are causing the problem. (remoting by using 'computer management')

Can anyone help write a command/batch file that could help do this in one go?
So the command would need to include my domain/username and password. Then I can list a number of IP addesses and the services I need to disable. Hit 'Return' and it disables the services on all the IP's chosen.
This would help greatly in what could be a very long drawnout task.

Many Thanks
 
I've d'loaded PsService, that looks to be ideal. How would I go about scripting it in a batch file.

I can use - psservice find [servicename]
this lists the pcs with that service running....

How would I then tell it to 'disable' that service on all those pcs that it was found on?

pskill just stops the process, but doesnt disable it.
 
Well without any testing... I would envision using two batch files something like:
Code:
psservice find [servicename] >> thelist.txt
(you might need user credentials, path, etc and possibly reformat the output file)

The second batch file would use a for loop with thelist.txt as input and the setconfig option to disabled. Something like:
Code:
for %i in ('thelist.txt') do (
  psservice \\%i setconfig disabled [servicename]
  )
(again, you might need to add user credentials, path, etc.) If the output format of the 'find' is nice and clean, you could probably even pipe the output of the first command directly into the second and do it all at once. Also, I just typed this without even looking, so the command format might not be quite right - for /? and psservice - should get you on track.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top