By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 1,192 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

start a windows service remotely

P: n/a
Hi,
I've written a windows service in vb.net, which works very well. The
service is installed on my server, but now I would like to be able to
start/stop it from any machine on the network.

I know the command sc.exe but unfortunately it does not prompt for
Username/Password, and those are required otherwise I'll always get the
message 'Access denied'. Unless I can bypass authentication to start a
windows service ?

Can you help ?

thanks

Nov 1 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"graphicsxp" <sa*************@googlemail.comwrote in
news:11**********************@i42g2000cwa.googlegr oups.com:
Hi,
I've written a windows service in vb.net, which works very well. The
service is installed on my server, but now I would like to be able to
start/stop it from any machine on the network.

I know the command sc.exe but unfortunately it does not prompt for
Username/Password, and those are required otherwise I'll always get the
message 'Access denied'. Unless I can bypass authentication to start a
windows service ?

You can use the ServiceController class in .NET to start/stop services
remotely.

Or you can do it via WMI.

Or you could build a remoting interface.

So there are several ways to do it :)
Nov 1 '06 #2

P: n/a
Hi,
Thank you for your reply.
Actually I've started using ServiceController class. However I can't
even access a service on my own machine... Here's what I do:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ServiceController1.Start()
End Sub

and

Me.ServiceController1.MachineName = "seoul"
Me.ServiceController1.ServiceName = "SMemory"

The error message I get is : Cannot start service SMemory on computer
'seoul'.
Any idea what I'm doing wrong ?

Spam Catcher wrote:
"graphicsxp" <sa*************@googlemail.comwrote in
news:11**********************@i42g2000cwa.googlegr oups.com:
Hi,
I've written a windows service in vb.net, which works very well. The
service is installed on my server, but now I would like to be able to
start/stop it from any machine on the network.

I know the command sc.exe but unfortunately it does not prompt for
Username/Password, and those are required otherwise I'll always get the
message 'Access denied'. Unless I can bypass authentication to start a
windows service ?


You can use the ServiceController class in .NET to start/stop services
remotely.

Or you can do it via WMI.

Or you could build a remoting interface.

So there are several ways to do it :)
Nov 1 '06 #3

P: n/a
graphicsxp wrote:
I know the command sc.exe but unfortunately it does not prompt for
Username/Password
What makes you think that it should?

Your service should be configured to always run under a given account so
you shouldn't need to provide username/password every time you start the
service.

Or is that you're trying to /configure/ these settings (using sc)?
IIRC, the "obj= " and "password= " options are the ones you need.

HTH,
Phill W.
Nov 1 '06 #4

P: n/a
hummm.... Well I gave up on using sc. And I wrote my own tool using
ServiceProcess to access the windows service and impersonation to get
granted user rights. It works great now.

thanks

Phill W. wrote:
graphicsxp wrote:
I know the command sc.exe but unfortunately it does not prompt for
Username/Password

What makes you think that it should?

Your service should be configured to always run under a given account so
you shouldn't need to provide username/password every time you start the
service.

Or is that you're trying to /configure/ these settings (using sc)?
IIRC, the "obj= " and "password= " options are the ones you need.

HTH,
Phill W.
Nov 1 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.