Question : Changes services via bat file

Wondering if it's possible to change the windows time services from starting manually to automatically via a bat file. I can start and stop the service via bat file but I can't change the properties of it to automatically start,

Thanks!


I also need this for Win2K if it's not the same command as XP.

Answer : Changes services via bat file

Since psservice can affect other computers, the simplest way to run this is from one machine. This will work on Win2K and XP.

First open a command prompt

then run this command
 for /f %i in ('net view') do psservice %i setconfig disabled

If you are a domain admin this will go recursively through the domain and set the service properties on every machine. If you want to work on only some of the computers make a list first and replace ('net view') with (computers.txt) where computers.txt is the list. you can generate it by running this:
net view > computers.txt

If you don't have a domain you can make up a list by hand and include the admin's username and password. 1 computer per line followed by username and password with spaces between. then the comand line would be:
for "tokens=1-3" %i in (computers.txt) Do psservice %i setconfig disabled
  -u %j - p %k

This way you don't expose passwords.

Good luck.

Random Solutions  
 
programming4us programming4us