ServiceController.GetServices( other pc )

B

Bram Hoefnagel

Hi,

On the 1.1 framework I couldn't find a solution to get a list of
services from an other PC. Only a list of services on My local PC.
(witch is strange i guess, as you look to the MSDN doc.)

But does someone know a way of getting a list of services on an 'other'
pc in the 2.0 framework.
this code anyhow trhows an exception.

ServiceController[] services;
ServiceController _serviceController = new ServiceController();
_serviceController.MachineName = "pc01";
services = ServiceController.GetServices("pc01");

results in:
Cannot open Service Control Manager on computer 'pc01'. This operation
might require other privileges.

Thnx
Bram
 
G

Guest

What's you privilegiest to that PC? Can u login to pc01?
On the 1.1 framework I couldn't find a solution to get a list of
services from an other PC. Only a list of services on My local PC.
(witch is strange i guess, as you look to the MSDN doc.)

But does someone know a way of getting a list of services on an 'other'
pc in the 2.0 framework.
this code anyhow trhows an exception.

ServiceController[] services;
ServiceController _serviceController = new ServiceController();
_serviceController.MachineName = "pc01";
services = ServiceController.GetServices("pc01");

results in:
Cannot open Service Control Manager on computer 'pc01'. This operation
might require other privileges.

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
B

Bram Hoefnagel

Ah....,
I can login to this pc01, only the service witch wants to retrieve the
list of services on pc01 can't.
Thnx Michael
 
W

Willy Denoyette [MVP]

| Ah....,
| I can login to this pc01, only the service witch wants to retrieve the
| list of services on pc01 can't.
| Thnx Michael
|

Services are not meant to access remote resources, they are meant to provide
services to internal and external clients. That's why they run as a "service
account" like "local system","local service" or "network service". If you
want a service to have access to external resources, you need to run that
service as a domain user or a user with access privileges on the remote
server. Another option, is to impersonate a domain or remote user while
accessing the remote resource, and keep your service running as "local
service" or "network service".


Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top