Jump to content

Stop Windows service on another server.


Recommended Posts

I am trying to stop a windows service on a separate server than where my script is running. When I run the following script on the same server as the service I need to stop, it works fine. 

RunWait(@ComSpec & " /c net stop FascetAgentfv2", @ScriptDir, @SW_HIDE);stop agent

But when I change "@ScriptDir" to ""\\newserver\c$\Program Files\test\" and run it on my server nothing happens. I tried to error handle and all it was returning was "2". Any suggestions?

Link to comment
Share on other sites

  • Moderators

First off, the help file is your friend - read up on the second parameter for RunWait - it is not to specify the server you want to target.

Secondly, net stop is not what you would use for remote service management, SC is the correct command. This works just fine for me:

ShellExecute("SC.exe", '\\MyServer Start AdobeARMservice', "", "", @SW_HIDE)

Sleep(5000)

ShellExecute("SC.exe", '\\MyServer Stop AdobeARMservice', "", "", @SW_HIDE)

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...