0

I'm creating a .bat file to restart a windows service on a remote server. I did some research on this and found 2 ways of executing this. 1. Using NET START "service" 2. Using SC //server START service

My question is, how do i supply the username and password that's required to login to the remote server? TELNET accepts server and the username, but the password doesn't work. Any pointers on this?

Kara
  • 6,115
  • 16
  • 50
  • 57
linkecho
  • 31
  • 1
  • 1
  • 6

2 Answers2

3

Got the answer! . Use this before using NET START or SC.

net use \\server password /USER:user 

Verified..and it worked flawlessly!

More info here: Start And Stop Windows Service remotely using PSEXEC

Community
  • 1
  • 1
linkecho
  • 31
  • 1
  • 1
  • 6
  • I am using my VPS IP address as server in above command and it says "System Error 53 has occurred". here is my command "net use \\IPADDRESS password /USER:username" – Nikhil Gaur Dec 25 '12 at 07:01
0

For things like these I normally install an SSH server on the remote host: Bitvise has one that works wonderfully on windows called WinSSH (They have a free Personal Edition). You then use Putty to execute the command remotely.

I don't think Telnet can execute commands remotely without an interactive shell.

Another option is to use Powershell Remoting, but someone else will have to help on that.

Hannes de Jager
  • 2,903
  • 6
  • 37
  • 57
  • Thanks!..I have a few roadblocks though. The remote server that i'm trying to connect to is controlled by our clients and they're finickey about addition of any new application to it. For WinSSH or Powershell to work, would there be any service on the server side that needs to be enabled? . I'm dealing with Windows Server 2003. – linkecho Feb 23 '11 at 10:00
  • WinSSH definitely installs a service. Not sure about powershell remoting, whether it uses a service or some existing infrastructure, maybe worth investigating. – Hannes de Jager Feb 23 '11 at 10:08