c# widows services...

  • Thread starter Thread starter jj
  • Start date Start date
J

jj

I have a changed my simple windows form application to simple service. It
collects file information.
My application uses WMI and I can collect file attributes from shared and
other nodes in the network.

However, with my service I can collect file attribute info only from the
local machine the servie is running NOT from other nodes.

Can somebody help me here....
Newbie here
thanks
 
How do you propose to collect information from "nodes" on another machine (on
the network I assume) -- you don't specify. Your Windows Service runs under
certain credentials, that you can control. If the account it is running under
can't access folders on another machine, then it's up to you to change that.
Peter
 
Hi jj,
If you look in the control panel at your service's properties (Log On
tab), you will probably see that your service is running under the
Local System account. When a process runs under this account, it has
different privileges than a process that runs interactively. One of
the major differences is that it does not have access to network
resources. You can verify this by changing the service to run under a
different account (pick "This account:") which does have the privileges
to access network resources.

Another major difference when running under the Local System account is
that you don't (by default) have access to the desktop session of the
logged in user. This means that if you try to have your service pop up
windows, etc... it might not work. The "interact with desktop" is
meant to solve this.

Hope this helps,
John
 
Please post your code or at least the part that deals with the WMI
connection.

Willy.

|I have a changed my simple windows form application to simple service. It
| collects file information.
| My application uses WMI and I can collect file attributes from shared and
| other nodes in the network.
|
| However, with my service I can collect file attribute info only from the
| local machine the servie is running NOT from other nodes.
|
| Can somebody help me here....
| Newbie here
| thanks
|
|
 
This is not the OP's issue. Using WMI (and it's wrapper classes in
System.Management) you have to specify explicit credentials to connect to
remote WMI services when connecting from a process that runs as a local
account.

Willy.

| Hi jj,
| If you look in the control panel at your service's properties (Log On
| tab), you will probably see that your service is running under the
| Local System account. When a process runs under this account, it has
| different privileges than a process that runs interactively. One of
| the major differences is that it does not have access to network
| resources. You can verify this by changing the service to run under a
| different account (pick "This account:") which does have the privileges
| to access network resources.
|
| Another major difference when running under the Local System account is
| that you don't (by default) have access to the desktop session of the
| logged in user. This means that if you try to have your service pop up
| windows, etc... it might not work. The "interact with desktop" is
| meant to solve this.
|
| Hope this helps,
| John
|
| jj wrote:
| > I have a changed my simple windows form application to simple service.
It
| > collects file information.
| > My application uses WMI and I can collect file attributes from shared
and
| > other nodes in the network.
| >
| > However, with my service I can collect file attribute info only from the
| > local machine the servie is running NOT from other nodes.
| >
| > Can somebody help me here....
| > Newbie here
| > thanks
|
 

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

Back
Top