user2928822
user2928822

Reputation: 35

SC start command on Windows Server

I am new to the Scripting World of Windows. I have written a batch script which automates start/stop of services on multiple servers from one unique server where all the servers are in the same subnet. I have used the SC command to serve my purpose. sc \%1 start %2, where %1 is the server and %2 is the service name which gets picked up from a text file. My query is, when I trigger the script from lets say server A to start service on server B, through which user does the service get started on server B? Is it the default administrator? My requirement is to start the service on remote server with a particular user on the remote server. Is this possible? Can it be done using the SC command or do I need to take a different approach for this. Thanks in advance.

Upvotes: 0

Views: 592

Answers (1)

Loïc MICHEL
Loïc MICHEL

Reputation: 26120

Your service will start with the account specified in its properties If you want to change this account you will have to reconfigure the service with sc config

sc config "service" obj= "domain\username" password= "password"

this will permenantly modify the service settings

Upvotes: 1

Related Questions