473,382 Members | 1,204 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

start a windows service remotely

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
4 9559
"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tom wilson | last post by:
I've been through everything with this error and cannot get the debugger to work remotely. The only thing I can trace it down to is that RPC is not communicating between servers. So after many,...
29
by: Ken Allen | last post by:
I have a number of services developed in C# (.Net), and they have been working fine for the most part. Recently someone reported that ipon occassion (originally rarely, but more frequently on some...
1
by: Zachariah | last post by:
I created a Windows Service and part of its functionality is to move a PDF file from a location on the service's local drive stInPath (C:\PDF\) to a location on another server stOutPath...
0
by: JDF | last post by:
I am trying to create a Windows service using SimpleXMLRPCServer and win32serviceutil. The service itself seems to be working properly (starts, stops, etc) and I can connect using an XMLRPC client...
1
by: schaf | last post by:
Hi all! I'm still trying to start/stop a service on a remote computer. (I promiss that's the last new post because of this problem from my side) My situation: I've an application running under...
2
by: Joachim | last post by:
Which ways are there to make my Windows Service functions accessible remotely in C#?
2
by: TampaWebDevelopment | last post by:
I have a Windows service that I have created. That service spins through the processes, looking to see if a certain application is running. If it is not, it starts it. The problem that I am having...
1
by: aj | last post by:
A few service stop/start/restart questions on SQL Server 2005 SP2, which I'll call SQLS. It looks as if there are *potentially* 6 ways to start/stop SQLS Services like the engine itself,...
3
by: =?Utf-8?B?bGVvMg==?= | last post by:
Hi All, I have a question which might be a beginner's question. I have a webservice whose webmethod has to call a window's service and get back the results. What is the best way to implement...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.