Я пытаюсь запустить файл bat удаленно (с XP на 2003) и сталкиваюсь с проблемой подключения к любому пространству имен WMI, кроме cimv2.Приведенный ниже код вызывает исключение «Не найдено» в вызове «GetMethodParameters».Но если я заменю «directory» на «cimv2», все будет просто.
ConnectionOptions theConnection = new ConnectionOptions();
theConnection.Username = conDet.User;
theConnection.Password = conDet.Pwd;
theConnection.Impersonation = ImpersonationLevel.Impersonate;
ManagementScope theScope = new ManagementScope(String.Format(@"\\{0}\root\directory", conDet.Server), theConnection);
theScope.Connect();
ManagementClass processClass = new ManagementClass(theScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
enter code here
ManagementBaseObject inParams = processClass.GetMethodParameters("Create");
inParams["CommandLine"] = filename;
ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams, null);
Я проверил безопасность на моей машине и на сервере, и два пространства имен имеют одинаковые настройки безопасности.Есть идеи, что происходит?
Спасибо.