PDA

View Full Version : سوال: ایجاد پردازش به صورت ریموت



cmsdqq2
جمعه 09 بهمن 1394, 19:21 عصر
سلام

بنده به یک سرور به صورت ریموت متصل شدم، حالا میخوام در اون سرور یک پردازش ایجاد کنم. کد زیر رو نوشتم اما خطای RCP is not available میده. میخواستم ببینم راهی هست؟







var processToRun = new[] { "notepad.exe" };
var connection = new ConnectionOptions();
connection.Username = txtUsername.Text;
connection.Password = txtPassword.Text;
var wmiScope = new ManagementScope(String.Format("\\\\{0}\\root\\cimv2", txtIP.Text), connection);
wmiScope.Connect();
var wmiProcess = new ManagementClass(wmiScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
wmiProcess.InvokeMethod("Create", processToRun);




این کد هم هست:







object[] theProcessToRun = { "notepad.exe" };
ConnectionOptions theConnection = new ConnectionOptions();
theConnection.Username = txtUsername.Text;
theConnection.Password = txtPassword.Text;
string server = "server";
ManagementScope manScope = new ManagementScope(String.Format(@"\\{0}\ROOT\CIMV2", server), connOptions);

ManagementScope theScope = new ManagementScope(String.Format(@"\\{0}\ROOT\CIMV2", server), theConnection);

ManagementScope theScope = new ManagementScope("\\\\" + "\\root\\cimv2", theConnection);
ManagementClass theClass = new ManagementClass(theScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
theClass.InvokeMethod("Create", theProcessToRun);



متاسفانه هیچ کدومشون کار نمیکنه