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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NETSVC.EXE crossing domain question

Status
Not open for further replies.

kb0ogt

IS-IT--Management
Jul 20, 2001
102
US
i need to use netsvc.exe to stop and restart a critical service on a server. the problem is that the server that is hosting the .bat file that will do this is on a different domain than the target machine. when the .bat file is fired i get a access denied error in a cmd window.

is there any arguements i can put in the .bat file to authenticate from the host machine to the target machine?
 
you can try adding /RUNAS:domain\user at the end of the command, this will allow you to enter credentials using another user.
 
like this?

c:\netsvc.exe cuservice \\servername /stop
echo Pausing 15 seconds
sleep 15
c:\netsvc.exe cuservice \\servername /start
/RUNAS:domain\user
 
in this case you would need to to apply the /runas at the end of each netsvc statement. What you can do though is to authenticate yourself to the server first like using net use \\servername /user:domain\useracct and from there you can just run the command as is
 
excellent, this is what i did and it works. Thank you very much!

net use \\servername /user:domain.local\administrator pw:xxxxxxxx
c:\netsvc.exe service \\servername /stop
echo Pausing 15 seconds
sleep 15
c:\netsvc.exe service \\servername /start
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top