473,386 Members | 1,702 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,386 software developers and data experts.

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 6707
Check out the System.ServiceProcess.ServiceController. 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
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...
4
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...
16
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...
0
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...
0
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...
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...
7
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...
4
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...
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,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.