From: muybluie on
Hi,

I am attempting to monitor a remote machine. When I run my app as the
current user, PdhConnectMachine succeeds.

But, if I attempt a call to PdhConnectMachine when running under the
LocalSystem account, I get PDH_CSTATUS_NO_MACHINE.

I imagine this has something to do with the access permissions for
LocalSystem. But what, exactly? And how do I resolve them?

Could this be locale related? I know PDH counters are locale
sensitive, and I know the locale for LocalSystem is not necessarily
the same as for other logins (LocalSystem is the default system locale
selected during installation of Windows, I think, while user locales
can be changed at any time).

Any help would be much appreciated,
Thanks!
From: Dean Earley on
muybluie(a)hotmail.com wrote:
> Hi,
>
> I am attempting to monitor a remote machine. When I run my app as the
> current user, PdhConnectMachine succeeds.
>
> But, if I attempt a call to PdhConnectMachine when running under the
> LocalSystem account, I get PDH_CSTATUS_NO_MACHINE.
>
> I imagine this has something to do with the access permissions for
> LocalSystem. But what, exactly? And how do I resolve them?

The LocalSystem user shouldn't have any network access, hence its name :)

--
Dean Earley (dean.earley(a)icode.co.uk)
i-Catcher Development Team

iCode Systems
From: muybluie on
On Aug 15, 11:35 am, Dean Earley <dean.ear...(a)icode.co.uk> wrote:
> muybl...(a)hotmail.com wrote:
> > Hi,
>
> > I am attempting to monitor a remote machine.  When I run my app as the
> > current user, PdhConnectMachine succeeds.
>
> > But, if I attempt a call to PdhConnectMachine when running under the
> > LocalSystem account, I get PDH_CSTATUS_NO_MACHINE.
>
> > I imagine this has something to do with the access permissions for
> > LocalSystem.  But what, exactly?  And how do I resolve them?
>
> The LocalSystem user shouldn't have any network access, hence its name :)
>
> --
> Dean Earley (dean.ear...(a)icode.co.uk)
> i-Catcher Development Team
>
> iCode Systems

And yet this works on many machines, but not at a customer site. We
can get this code to work successfully in our labs, running as
LocalSystem...
From: muybluie on
On Aug 15, 11:58 am, muybl...(a)hotmail.com wrote:
> On Aug 15, 11:35 am, Dean Earley <dean.ear...(a)icode.co.uk> wrote:
>
>
>
>
>
> > muybl...(a)hotmail.com wrote:
> > > Hi,
>
> > > I am attempting to monitor a remote machine.  When I run my app as the
> > > current user, PdhConnectMachine succeeds.
>
> > > But, if I attempt a call to PdhConnectMachine when running under the
> > > LocalSystem account, I get PDH_CSTATUS_NO_MACHINE.
>
> > > I imagine this has something to do with the access permissions for
> > > LocalSystem.  But what, exactly?  And how do I resolve them?
>
> > The LocalSystem user shouldn't have any network access, hence its name :)
>
> > --
> > Dean Earley (dean.ear...(a)icode.co.uk)
> > i-Catcher Development Team
>
> > iCode Systems
>
> And yet this works on many machines, but not at a customer site.  We
> can get this code to work successfully in our labs, running as
> LocalSystem...- Hide quoted text -
>
> - Show quoted text -

My mistake - we call WNetAddConnection2 in order to connect to the
resource as a non LocalSystem account, and then call
PdhConnectMachine, so we should be using the same credentials all the
time.