Все,
Я пытаюсь удалить программное обеспечение удаленно, на тестовых машинах оно работает нормально, но у меня возникли проблемы на рабочих серверах.
тестовые машины я использовал Windows XP, Windows 2003 Server,
производственный компьютер: Windows Server 2003.
что может быть причиной этой ошибки, любая помощь будет более ценной.
если у вас есть какой-либо другой способ деинсталлировать программное обеспечение на удаленном ПК, пожалуйста, поделитесь.
public void Uninstallwithguid(string targetServer, string product,string guid, string version)
{
this.Project.Log(Level.Info, "Starting Uninstall " );
this.Project.Log(Level.Info, "targetServer :" + targetServer );
this.Project.Log(Level.Info, "product :" + product );
this.Project.Log(Level.Info, "guid :" + guid );
this.Project.Log(Level.Info, "version :" + version );
System.Management.ConnectionOptions connoptions = new System.Management.ConnectionOptions();
connoptions.Impersonation = System.Management.ImpersonationLevel.Impersonate;
connoptions.Timeout = new TimeSpan(0, 0, 10); // 10 seconds
System.Management.ManagementScope scope = new System.Management.ManagementScope(@"\\" + targetServer + @"\root\cimv2", connoptions);
scope.Connect();
System.Management.ObjectGetOptions objoptions = new System.Management.ObjectGetOptions();
string test = @"\\" + targetServer + @"\root\cimv2";
string objPath = string.Format("Win32_Product.IdentifyingNumber='{0}',Name='{1}',Version='{2}'",guid, product, version);
System.Management.ManagementPath path = new System.Management.ManagementPath(objPath);
System.Management.ManagementObject moobj = new System.Management.ManagementObject(scope, path, null);
UInt32 res1 = 0;
try
{
res1 = (UInt32)moobj.InvokeMethod("Uninstall", null);
}
catch(Exception ex)
{
this.Project.Log(Level.Error, ex.ToString());
throw ex;
}
if (res1 != 0)
{
this.Project.Log(Level.Error, "Uninstall error " + res1.ToString());
throw new Exception("Uninstall error " + res1.ToString());
}
}
Описание ошибки:
System.Management.ManagementException: недопустимый класс
в System.Management.ManagementException.ThrowWithExtendedInfo (ManagementStatus errorCode)
в System.Management.ManagementObject.Initialize (Boolean getObject)
в System.Management.ManagementObject.get_ClassPath ()
в System.Management.ManagementObject.GetMethodParameters (String methodName, ManagementBaseObject & inParameters, IWbemClassObjectFreeThreaded & inParametersClass, IWbemClassObjectFreeThreaded & outParametersClass)
в System.Management.ManagementObject.InvokeMethod (String methodName, Object [] args)