title: Start process with WMI on remote machine from a share on another remote machine
body: <p>I have the following code to run a process on a remote machine from a share on a second remote machine as described in the image:</p>
  <p><a href="https://i.stack.imgur.com/jLe2p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jLe2p.png" alt="Connection" /></a><br />
  <sub>(source: <a href="http://i.msdn.microsoft.com/dynimg/IC116011.png" rel="nofollow noreferrer">microsoft.com</a>)</sub></p>
  <pre><code>public class Runner
  {
      public static string RunExecutable(string machine, string executable, string username, string password, string domain)
      {
          try
          {
              ConnectionOptions connectionOptions = new ConnectionOptions();
              connectionOptions.Authority = &quot;kerberos:&quot; + domain + @&quot;\&quot; + machine;
              connectionOptions.Username = username;
              connectionOptions.Password = password;
              connectionOptions.Impersonation = ImpersonationLevel.Delegate;
              connectionOptions.Authentication = AuthenticationLevel.PacketPrivacy;
  
              //define the WMI root name space
              ManagementScope scope = new ManagementScope(@&quot;\\&quot; + machine + &quot;.&quot; + domain + @&quot;\root\CIMV2&quot;, connectionOptions);
  
              //define path for the WMI class
              ManagementPath p = new ManagementPath(&quot;Win32_Process&quot;);
  
              //define new instance
              ManagementClass classInstance = new ManagementClass(scope, p, null);
  
              ManagementClass startupSettings = new ManagementClass(&quot;Win32_ProcessStartup&quot;);
              startupSettings.Scope = scope;
              startupSettings[&quot;CreateFlags&quot;] = 16777216;
  
              // Obtain in-parameters for the method
              ManagementBaseObject inParams = classInstance.GetMethodParameters(&quot;Create&quot;);
  
              // Add the input parameters.
              inParams[&quot;CommandLine&quot;] = executable;
              inParams[&quot;ProcessStartupInformation&quot;] = startupSettings;
  
              // Execute the method and obtain the return values.
              ManagementBaseObject outParams = classInstance.InvokeMethod(&quot;Create&quot;, inParams, null);
  
              // List outParams
              string retVal = outParams[&quot;ReturnValue&quot;].ToString();
              return &quot;ReturnValue: &quot; + retVal;
          }
  
          catch (ManagementException me)
          {
              return me.Message;
          }
  
          catch (COMException ioe)
          {
              return ioe.Message;
          }
      }
  }
  </code></pre>
  <p>I have 5 machines in my environment, all in the same domain. 3 are running Windows Server 2008R2, one Windows 7 and one Windows XP:</p>
  <ul>
  <li>WinXP</li>
  <li>Win7</li>
  <li>Master2008</li>
  <li>Slave2008-1</li>
  <li>Slave2008-2</li>
  </ul>
  <p>I run the code from Master2008, the domain controller, and try to start a process on the other machines, but run into some problems when starting a process on the XP and 7 machines.</p>
  <p>When starting the process on the WinXP and Win7 machines i get a return value of 8, which is &quot;Unknown error&quot;, but when starting the process on the Server 2008R2 machines it works without problems.</p>
  <p>All the machines has been marked as trusted for delegation in AD.</p>
  <p>The process I'm trying to start is \\&quot;machine&quot;\c$\Windows\System32\Calc.exe</p>
  <p>I've tried running the process from different machines, and the result was the following (The program is beeing run on Master2008):</p>
  <pre><code>On WinXP
   - From Win7: Failed (8)
   - From Slave2008-1: Failed (8)
   - From Slave2008-2: Failed (8)
   - From Master2008: Failed (8)
  
  On Win7
   - From WinXP: Success (0)
   - From Slave2008-1: Failed (8)
   - From Slave2008-2: Failed (8)
   - From Master2008: Failed (8)
  
  On Slave2008-1
   - From WinXP: Success (0)
   - From Win7: Success (0)
   - From Slave2008-2: Success (0)
   - From Master2008: Success (0)
  
  On Slave2008-2
   - From WinXP: Success (0)
   - From Win7: Success (0)
   - From Slave2008-1: Success (0)
   - From Master2008: Success (0)
  </code></pre>
  <p>For some reason, they all fail for WinXP machine, but the Win7 machine can install from the WinXP machine.</p>
  <p>Does anyone have any idea what can be wrong?</p>