Script to change logon user of windows service

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Guest
Archived from groups: microsoft.public.win2000.advanced_server (More info?)

Hello,
I have few Windows services running under windows 2000. These services
run under a specific logon user.

I need to create a script
a)To stop these services.
b)Change the userid and password of the domain user under which the
service is running
c)Start the service again

I have several services running under different users. I dont want to
change them manually thru control panel.Instead I want to write a
batch file or a script to do this.
I'm not sure which windows objects to use for this purpose.
If someone could direct me links to these objects that would be great.
I'm looking at writing either a vbscript(.vbs) or some batch files.

Thanks,
Mahesha
 
Archived from groups: microsoft.public.win2000.advanced_server (More info?)

On 12 Aug 2004 19:06:10 -0700, ycmahesh@hotmail.com (Mahesha) wrote:

>Hello,
>I have few Windows services running under windows 2000. These services
>run under a specific logon user.
>
>I need to create a script
>a)To stop these services.
>b)Change the userid and password of the domain user under which the
>service is running
>c)Start the service again
>
>I have several services running under different users. I dont want to
>change them manually thru control panel.Instead I want to write a
>batch file or a script to do this.
>I'm not sure which windows objects to use for this purpose.
>If someone could direct me links to these objects that would be great.
>I'm looking at writing either a vbscript(.vbs) or some batch files.
>
>Thanks,
>Mahesha

Use SC from the resource kit:

C:\>sc stop
DESCRIPTION:
Sends a STOP control request to a service.
USAGE:
sc <server> stop [service name]

C:\>sc start
DESCRIPTION:
Starts a service running.
USAGE:
sc <server> start [service name] <arg1> <arg2> ...

C:\>sc config
Modifies a service entry in the registry and Service Database.
SYNTAX:
sc <server> config [service name] <option1> <option2>...
CONFIG OPTIONS:
NOTE: The option name includes the equal sign.
type= <own|share|interact|kernel|filesys|rec|adapt>
start= <boot|system|auto|demand|disabled>
error= <normal|severe|critical|ignore>
binPath= <BinaryPathName>
group= <LoadOrderGroup>
tag= <yes|no>
depend= <Dependencies(separated by / (forward slash))>
obj= <AccountName|ObjectName>
DisplayName= <display name>
password= <password>

Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com