Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7545007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:49:09+00:00 2026-05-30T08:49:09+00:00

I have the following code to run a process on a remote machine from

  • 0

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:

Connection
(source: microsoft.com)

public class Runner
{
    public static string RunExecutable(string machine, string executable, string username, string password, string domain)
    {
        try
        {
            ConnectionOptions connectionOptions = new ConnectionOptions();
            connectionOptions.Authority = "kerberos:" + domain + @"\" + 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(@"\\" + machine + "." + domain + @"\root\CIMV2", connectionOptions);

            //define path for the WMI class
            ManagementPath p = new ManagementPath("Win32_Process");

            //define new instance
            ManagementClass classInstance = new ManagementClass(scope, p, null);

            ManagementClass startupSettings = new ManagementClass("Win32_ProcessStartup");
            startupSettings.Scope = scope;
            startupSettings["CreateFlags"] = 16777216;

            // Obtain in-parameters for the method
            ManagementBaseObject inParams = classInstance.GetMethodParameters("Create");

            // Add the input parameters.
            inParams["CommandLine"] = executable;
            inParams["ProcessStartupInformation"] = startupSettings;

            // Execute the method and obtain the return values.
            ManagementBaseObject outParams = classInstance.InvokeMethod("Create", inParams, null);

            // List outParams
            string retVal = outParams["ReturnValue"].ToString();
            return "ReturnValue: " + retVal;
        }

        catch (ManagementException me)
        {
            return me.Message;
        }

        catch (COMException ioe)
        {
            return ioe.Message;
        }
    }
}

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:

  • WinXP
  • Win7
  • Master2008
  • Slave2008-1
  • Slave2008-2

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.

When starting the process on the WinXP and Win7 machines i get a return value of 8, which is "Unknown error", but when starting the process on the Server 2008R2 machines it works without problems.

All the machines has been marked as trusted for delegation in AD.

The process I’m trying to start is \\"machine"\c$\Windows\System32\Calc.exe

I’ve tried running the process from different machines, and the result was the following (The program is beeing run on Master2008):

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)

For some reason, they all fail for WinXP machine, but the Win7 machine can install from the WinXP machine.

Does anyone have any idea what can be wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:49:11+00:00Added an answer on May 30, 2026 at 8:49 am

    It seems there were no problem with the code. I tried to make a simple application to start instead of “calc.exe” and it worked as it should.

    The problem was that I was trying to start “calc.exe” from 64bit servers on a 32bit clients. Also, “calc.exe” on Windows7 wont run on WindowsXP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code snippet that i use to compile class at the run
Let's say that I have the following code that's run in one thread of
I have the following code I want to run, but the problem is $this->type
I have the following code, which is run every 10ms as part of a
I have the following sample code which doesn't seem to want to run. import
I have a line of code that gets the following error when run through
I have the following code: MSG mssg; // run till completed while (true) {
I have the following code written to make my lazy second CPU core working.
i have following php code which display company logo <?php $key=$_GET['key']; /// key process
I have the following code to run python and get the result in scratch

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.