Jump to content

PdhConnectMachine from a Service


Recommended Posts

Guest muybluie@hotmail.com
Posted

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!

  • Replies 0
  • Created
  • Last Reply

Popular Days

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...