473,732 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Start and Stop service on remote server programatically

I need to be able to start and stop a service on another computer on
the network. But I cannot connect to the other computer using my
standard user credentials. I have a separate login for that for which
I use Remote Desktop to connect to the other machine.

The other machine is a test server where my Windows Service application
is running. It is an inconvenience to have to connect through Remote
Desktop just to start and stop the service.

I would like to create a small app with a single button that I can use
to simply stop the service and start it as needed.

How can I connect to the remote machine using the appropriate
credentials programatically so that my program impersonates the correct
user account on the other machine?

Thanks,

Jan 30 '06 #1
2 6775
Check out the System.ServiceP rocess.ServiceC ontroller. It is designed for
what you want.

"Chris Dunaway" wrote:
I need to be able to start and stop a service on another computer on
the network. But I cannot connect to the other computer using my
standard user credentials. I have a separate login for that for which
I use Remote Desktop to connect to the other machine.

The other machine is a test server where my Windows Service application
is running. It is an inconvenience to have to connect through Remote
Desktop just to start and stop the service.

I would like to create a small app with a single button that I can use
to simply stop the service and start it as needed.

How can I connect to the remote machine using the appropriate
credentials programatically so that my program impersonates the correct
user account on the other machine?

Thanks,

Jan 30 '06 #2
Yes, I am familiar with that part. What is not apparent is how to
impersonate a different user on the remote machine. I have figured
that out.

Jan 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
21910
by: Mark | last post by:
I created an extremely simple windows service that only writes to the EventLogs on Stop and Pause. I installed it using the InstallUtil.exe program, the output of which is below. It appears to be successful. I'm now ready to start my service (I think) but the NET START command does not appear to indicate that the service is available to be run. The output for NET START is below as well. The Services list in the W2K administrator...
4
2699
by: vickaiser1 | last post by:
I am creating a setup project for an application and need to edit the Metabase.xml file during setup. Does anyone know of a way to stop and then restart services programatically before and after I edit this file? Vic
16
4217
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the project in debug mode (by hitting F5) it gives an error message "Error while trying to run project: Unable to start debugging on the web server.
0
967
by: Chris Dunaway | last post by:
I wish to write a small application that will allow me to start and stop a windows service on another server. Currently, I have to connect to the server using Remote Desktop Connection and then log into the server using a special login and password. Then I can open the services applet and start and stop the server. This is very inconvenient for debugging the service. What I would like to do, from my dev box, is somehow connect to...
0
1308
by: louise.kelly | last post by:
Hi All, Looking for a bit of help here. I have a VB.NET application that runs as a service on a W2003 Server, well that sometimes runs as a service. If I start the service while connected to the server via remote desktop, the service starts successfully and all is hunky dory. However, if I logon directly to the server as the same user, I get the message:
1
16392
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 the user paul (pw:paul123) on the computer A in the domain ABC. This application should stop / start a service, which is running on computer B (in workgroup ABCWG (NOT IN DOMAIN ABC)). On the computer B I have a user administrator (pw: adminTest)...
7
7230
by: shai | last post by:
I am working at .net 1.1, writing in c#. I have windows service with a COM object. Every unexpected time The COM object throw an error that make my service get stuck (do not respond). I can catch this error. I want to restart my windows service every time the COM object throws an error. I use System.ServiceProcess.ServiceController to stop and start my service. But there is one thing I do not understand:
4
21740
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a webserver to see if service A needs to be updated. What service B does if it sees their is an update for service A is to download a new copy of the service A executable, stop service A, replace the executable with the new copy, and start service B...
1
5663
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, integration services, reporting service, Agent.. -SQLS Configuration Manager -SQLS Surface Area Configuration (for Services and Connections) -Mgmt Studio Local (on server)
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9235
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.