Re: How to remote start/stop services using windows API?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



That isn't what the question seemed to say. This is now much clearer..

It is risky to use the service key name because this could be localized, but it should
work.

But as far as I can tell, OpenSCMManager needs only the machine name and the desired
access (the rights are checked against the currently-logged-in user).

What errors did you see, and from which API? Did it fail to open? Did OpenService fail?
What rights had you asked for in OpenService? and so on.

Without knowing the errors you are seeing, it is hard to tell exactly that the correct
approach might be.
joe

On Wed, 7 Nov 2007 18:34:01 -0800, Tom Lee <Tom.Lee@xxxxxxxxxxxxxxxx> wrote:

It seems you don't understand my question at all. I am trying to explain to
you... Hope you could understand it.

We could use the following APIs to start a service process remotely:
OpenSCManager()
GetServiceKeyName()
OpenService()
QueryServiceStatusEx()
ControlServiceEx()
StartService()
CloseServiceHandle()
But we could not use these APIs to get the remote user handle/credential, we
must need another function to do it. WNetAddConnetion2 could be used to get
the remote user credential, but it will fail in some cases. So I am searching
another way to do it.
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.