Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

how to provide system.diagnostics.performancecounter impersonation through c#?

$
0
0
i have used the following code,
static void Main(string[] args)
{

PerformanceCounterCategory cat = new PerformanceCounterCategory("Processor", "172.16.2.171");
List<PerformanceCounter> counters = new List<PerformanceCounter>();
foreach (string instance in cat.GetInstanceNames())
counters.Add(new PerformanceCounter("Processor", "% Processor Time", instance, "172.16.2.171"));
for (int i = 0; i < 10000; i++)
{
foreach (PerformanceCounter counter in counters)
Console.Write(counter.NextValue() + " ");
}

}

it results the "Access is Denied Error", the remote system has the credentials suchas domainname, username, password . how can i provide credentials in performancecounter class to obtain the remote system performance

Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>