I’m trying to execute a program that is on machine B (Part of a domain) from machine A (Not part of domain). I’ve the following code and throws “The RPC Server is unavailable” when I tried to use a domain user that is part of machine B’s Administrators group. When I use the local user “administrator” which is also part of Machine B’s Administrators group, the code works fine.
Firewall is disabled on both the machines. I could logon to machine B from machine A using both the users.
Could you help me with it?
ConnectionOptions connectionOptions = new ConnectionOptions();
connectionOptions.Authority = "kerberos:" + domain + @"\" + machine;
connectionOptions.Impersonation = ImpersonationLevel.Impersonate;
connectionOptions.Authentication = AuthenticationLevel.PacketPrivacy;
connectionOptions.Username = username;
connectionOptions.Password = password;
ManagementScope scope = new ManagementScope(@"\\" + machine + "." + domain + @"\root\CIMV2", connectionOptions);
ManagementPath p = new ManagementPath("Win32_Process");
ManagementClass classInstance = new ManagementClass(scope, p, null);
ManagementClass startupSettings = new ManagementClass("Win32_ProcessStartup");
startupSettings.Scope = scope;
startupSettings["CreateFlags"] = 16777216;
I could sort the problem out. The domain controller was not accessible. Also, both public and private IPs were configured to my machine. The private IP was the primary and public was secondary. I needed to use them accordingly when needed.