title: Why does my WMI InvokeMethod call return 0 (success) but fail to do anything remotely?
body: <p>I have a very simple WMI method that connects to a remote server to kick off a batch file.  </p>
  
  <p>The return code from this execution is 0, telling me it succeeded.  If I change the path to the batch file, it returns a 9 so I know it's finding the command file.</p>
  
  <p>Problem is, when I look on the server, I can see that nothing has happened.  The first thing this batch file does is delete the GIT repo from the drive.</p>
  
  <p>My code is:</p>
  
  <pre><code>public object[] ProcessToRun;
  
      public void StartBuild()
      {
          ProcessToRun = BuildServerInfo.SelectedBranch == BuildServerBranch.Branch.Development ? new object[] { "c:\\src\\Build\\Batch1_Development.cmd" } : new object[] { "c:\\src\\Build\\Batch2_Release_Candidate.cmd" };
          var connection = new ConnectionOptions();
  
          connection.Impersonation = ImpersonationLevel.Impersonate;
          connection.Authentication = AuthenticationLevel.Packet;
          connection.EnablePrivileges = true;
          connection.Timeout = new TimeSpan(0,0,15);
  
          var mp = new ManagementPath("\\\\" + BuildServerInfo.BuildServer + "\\root" + "\\cimv2:Win32_LogicalDisk.DeviceID=\"C:\"");
          var ms = new ManagementScope(mp, connection);
  
          var mprocess = new ManagementClass(ms, new ManagementPath("Win32_Process"), new ObjectGetOptions());
          var results = mprocess.InvokeMethod("Create", ProcessToRun);
      }
  </code></pre>
  
  <p>Is this a problem with the code, or is there something I need to do with my server? The server is Windows 2008 R2.</p>
  
  <p>Thanks.</p>
  
  <p>Edit: My account has full admin privileges and the WMI users under CIMV2\Security have full access.</p>