Führen Sie den Prozess im Remote -Computer mit einem fehlgeschlagenen WMI aus

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Führen Sie den Prozess im Remote -Computer mit einem fehlgeschlagenen WMI aus

by Anonymous » 09 Apr 2025, 21:50

Ich bin ein Administrator und möchte Helpdesk -Sachen delegieren, um einige Anwendungen zu machen, die stille Installationen durchführen, die Administrator benötigen. Rechte, ich habe den folgenden Code ausprobiert und erhält immer die Fehlermeldung 'RPC -Server ist nicht verfügbar. Ich kann nicht herausfinden, was mit meinem Code falsch ist. Jede Hilfe wird sehr geschätzt. < /p>

Code: Select all

  public static string ahmed(string machine, string username, string password, string domain)
{
try
{
ConnectionOptions connectionOptions = new ConnectionOptions();
connectionOptions.Authority = "ntlmdomain:" + 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 processClass = new ManagementClass(scope, p, null);

// Create an array containing all
// arguments for the method
object[] methodArgs =
{@"mkdir c:\testtest", null, null, 0};

//Execute the method
object result =
processClass.InvokeMethod(
"Create", methodArgs);

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

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

Top