title: Access denied reading Perfmon counters from a remote machine (Asp.Net)
body: <p>I'm trying to create a simple Asp.Net page to read Perfmon counters from a remote machine.</p>
  
  <p>When I run the page using the Visual Studio development web server all is well, however when I attempt to run the same page when its hosted on IIS I get an access denied error on the line that instantiates the Perfmon counter:</p>
  
  <pre><code>PerformanceCounter freeSpaceCounter = new PerformanceCounter("LogicalDisk", "Free Megabytes", "D:", "RemoteMachine12");
  </code></pre>
  
  <p>This is the exception I get:</p>
  
  <pre><code>Exception Details: System.ComponentModel.Win32Exception: Access is denied
  </code></pre>
  
  <p>I've tried using both anonymous access (with myself as the anonymous user) and Integrated Windows Authentication - both dont work.  Clearly some other account is be used to read the PerfMon counters (like the ASPNET account).  How do I get my page to access the PerfMon counters using my account rather than that account?</p>