|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
start a windows service remotelyHi,
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 "graphicsxp" <samuelberthe***@googlemail.com> wrote in You can use the ServiceController class in .NET to start/stop services news:1162388835.159321.184730@i42g2000cwa.googlegroups.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 ? remotely. Or you can do it via WMI. Or you could build a remoting interface. So there are several ways to do it :) 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: Show quoteHide quote > "graphicsxp" <samuelberthe***@googlemail.com> wrote in > news:1162388835.159321.184730@i42g2000cwa.googlegroups.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 :) graphicsxp wrote:
> I know the command sc.exe but unfortunately it does not prompt for What makes you think that it should?> Username/Password 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. 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: Show quoteHide quote > 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. |
|||||||||||||||||||||||