PdhConnectMachine from a Service

  • Thread starter muybluie@hotmail.com
  • Start date
M

muybluie@hotmail.com

Hi,

This has been posted before, but I could not find a proper resolution
or explnantion for what I am seeing.

I have an app that performs a PdhConnectMachine in order to monitor a
remote machines performance counters. This app runs as scheduled task
under the SYSTEM account. Prior to calling PdhConnectMachine, it
calls WNetAddConnection2 in order to create a connection, which I
think PdhConnectMachine uses to connect. WNetAddConnection2 has a
user and password supplied to it externally.

This works fine on a number of machines here at the office, but does
not work on a remote site. PdhConnectMachine fails with
PDH_CSTATUS_NO_MACHINE. However, WNetAddConnection2 always succeeds.

Also, if the same app is run directly by a user (i.e. a login other
than SYSTEM), the app succeeds.

The fact that it works in some cases seems to imply that this is not
some inherent issue with using the SYSTEM account to perform these
actions. Are there some network security settings IT administrators
can apply that would cause this? Or perhaps there are some other
security settings which could cause this to fail for some machines,
but not for others?


Thanks!
 
Back
Top Bottom