У меня есть две машины, скажем Machine1 и Machine2. Я сопоставил одну общую папку в Machine2 в Machine1 как Z. Я запустил одно приложение, скажем, App1, в котором перечислены все диски машины и приложения, находится в Machine1. Я начал этот App1 с Machine1, и я получил все свои диски Включая сопоставленный диск «Z». Но когда я начал приложение 1, которое находится в Machine1 от Machine2, используя WMI [Instrumentation для управления Windows. Код, используемый для связи WMI, приведен ниже.]. В App1 перечислены все диски, кроме подключенного сетевого диска «Z». Есть ли способ указать все диски Machine1, даже если я запускаю App1 из Machine2 с помощью WMI.Mapped Network drive не смог получить доступ с помощью WMI
// Code to start application on remote machine.
ManagementPath path = new ManagementPath(string.Format(@"\\{0}\root\cimv2:Win32_Process", machine));
try
{
// Connect options include user name and password of the remote machine to connect.
ConnectionOptions options = new ConnectionOptions();
options.Username = UserName;
options.Password = Password;
ManagementPath path = new ManagementPath(string.Format(@"\\{0}\root\cimv2:Win32_Directory", machine));
ManagementScope scope = new ManagementScope(path, options);
if(scope != null)
{
ObjectGetOptions getOptions = new ObjectGetOptions();
ManagementClass cimInstance = new ManagementClass(scope, path, getOptions);
// Fill the necessary parameters for Create method of Win32 Process.
ManagementBaseObject inParams = cimInstance.GetMethodParameters("Create");
// Commandline is the full path of the application including the exe name.
inParams["CommandLine"] = commandLine;
// Execute the method and obtain the return values.
cimInstance.InvokeMethod("Create", inParams, null);
}
}
Me пытается используя .Net 2.0 Windows.