1

I have a bat file that tries to stop a service on a remote machine, the file contains the following

psservice \\remoteServerName -u domainName\userName -p password stop serviceName

where userName is a name of a user with Admin privileges on the remote machine.

If I run the last line using cmd then the requested service does stop.

I, however, run the bat file using psexec, since it contains more operation than just stopping the service. This is where my problem occurs:

If I run

psexec -u domainName\userName -p passsword batFilePath

the cmd window seems to get stuck.

But if I run

 psexec batFilePath

then the psservice executes correctly.

My problem is that I need the user "domainName\userName" to be able to run the other commands in the bat file.

What can I do ? Why does the cmd got stuck when I gave psexec the parameters of the userName and password ?

Belgi
  • 14,542
  • 22
  • 58
  • 68
  • If psservice hasn't been run on the remote machine before, it will be waiting for you to accept the EULA. Try `psservice /accepteula ...` – Harry Johnston Aug 30 '16 at 00:15

0 Answers0