August 21st, 2009, 01:35 PM
|
#1 (permalink)
|
| Mobile Member
Join Date: Apr 2005 Location: S. Central PA
Posts: 3,601
| batch file to reset services, need to set explicit credentials
I'm trying to create a batch file here to STOP and then START services on a remote machine. Currently I have been using the SC command and I tried looking at NET STOP/START a little bit. I have also messed with SysInternals' psexec program but all with no luck. I tried using psexec to launch the batch file contents below but it bombs with an "error code 1" so I have been trying different routes...
I want to create a batch file to ECHO something to the user, they click a button, it'll stop the services, then ECHO something else, then they click a button and then it'll start those services back up. I have sufficient network rights that it works fine for me just using the following: Code: ECHO This will reset blah blah blah
PAUSE
sc \\srv1 stop servicename
sc \\srv2 stop servicename
ECHO Please wait a few seconds and then...
PAUSE
sc \\srv1 start servicename
sc \\srv2 start servicename but this wont work for limited users and I dont want to increase their network rights, this is just while I'm out for vacation. So I want to give it an explicit user that I setup just for this that will have sufficient rights to the service control module on those servers. so I can say the user with the DOMAIN\User context and include the password which I think would work best in double quotes.
Any takers on this, I think I'm just missing something simple, any tricks to doing this that I dont know about? 
__________________ Thinkpad T61 14.1" wide | WinXP Pro | C2D T8300 CPU | 3GB DDR2 | 160GB HDD | AGN & WWAN
Lenovo S10 10.2" LED display | 1.6Ghz Atom CPU | 1GB DDR2 | 1.3mp webcam | B/G WiFi | 160GB HDD |
| |