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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gomathipriya
    New Member
    • May 2013
    • 16

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

    i have used the following code,
    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 performancecoun ter class to obtain the remote system performance
    Last edited by Rabbit; May 5 '13, 03:37 AM. Reason: Please use code tags when posting code.
Working...