i have used the following code,
it results the "Access is Denied Error", the remote system has the credentials suchas domainname, username, password . how can i provide credentials in performancecoun ter class to obtain the remote system performance
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() + " "); } }