How to restart local windows service using PSExec or PSTools

I just want to start/stop service just on my pc (no remote connection) via bat script in a way that no "Run as admin" prompt appears. Just don't want to do any manual interaction after running the script. I have found articles showing that this would be possible via PSTools (PSExec or PSTools in particular). It is ok to me that password is visible inside a script. But when I run the following command:

psexec -u myuser -p mypass net stop myservice

I get: net exited with error code 2.

When I try to use -h:

psexec -h -u myuser -p mypass net stop myservice

I get: Couldn't install PSEXESVC service: The network path was not found. Make sure that the admin$ share is enabled. I don't know what admin share is, don't want to share something on the network.

Whiles using on PSService:

psservice -u myuser -p mypass stop myservice

The folowing error is shown: Error opening myservice on \\MY-PC: Access is denied.

myuser is the only user on the pc, and it's admin. Isn't there a simple solution on this? Other tools can be used also. Disabling UAC is not an option.

6 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like