Getting Performance counters as a different user

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am writing a utility to get the performance counters from a remote
machine. Currently, I am usign the System.Diagnostics.PerformanceCounter
class to retrieve these counters, but they only retrieve the counters with
the permissions of the owneer of my utility's process.

I dont see any way within this class to provide a different authentication
to let the user get the counters with different permissions (windows
username/password). Does anyone know of a workaround or solution to this?

Thanks,
Don
 
Several possibilities exist to solve this:

1. establish a use record with the remote server's administrative resource,
this can be done using following command (from code - using Process.Start or
the command line):

net use \\remserver\IPC$ pwd /user:domain\administrator

where remserver is to remote machine name, pwd is the password of an
administrator account (or an account with privileges to profile system
perf.) , domain is the remote machine name (don't use a domain account).

Delete the use record when done:
net use \\remserver\IPC$ /delete

2. Use System.Management and WMI to read remote perf. counters.

3. Impersonate a remote administrators account.

Willy.
 
Back
Top