title: Access is Denied when connecting to remote computer using WMI from app under IIS
body: <p>I am getting <code>Access is denied</code> exception when I try to connect to a remote server using WMI through IIS (10.0).  This same code works fine through Visual Studio 2015 debug (IIS Express).  Obviously this is a permissions issue, however I cannot find anything definitive or even suggestive on the best way to approach this.</p>
  
  <p>In my example, the client simply makes a POST call to the web service with credentials in the payload.  Then the service attempts to make a WMI connection getting the exception.  The remote server is not in a domain, and the credentials have been verified to have access to the given namespaces.</p>
  
  <p>I'm running IIS 10, but have duplicated this with as low as IIS 7.</p>
  
  <p>Any help is appreciated!</p>
  
  <pre><code>public ManagementScope Connect(Credentials creds, string path)
      {
          _creds = creds;
          _path = path;
  
          var conOpt = new ConnectionOptions
          {
              Impersonation = ImpersonationLevel.Impersonate,
              Authentication = AuthenticationLevel.PacketPrivacy,
              EnablePrivileges = true,
              Username = _creds.Username,
              Password = _creds.Password,
              //Authority = $"ntlmdomain:{_creds.Domain}"
          };
          // virtualization\v2
          _scope = new ManagementScope($@"\\{_creds.Server}\ROOT\{path}", conOpt);
          _scope.Connect();
  
          return _scope;
      }
  </code></pre>