Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more: , +
I have .Net WMI Provider extension.

I am Installing my provider using InstallUtil.
If I remove my assembly without uninstalling using InstallUtil.
During installation the MOF file is getting created successfully but it's failing to compile.

It giving error like this...

CSS
An error occurred while processing item 2 defined on lines 12 - 22 in file C:\Windows\system32\wbem\AMIDiagProvider_v4.0.30319.mof:
Compiler returned error 0x80041026Error Number: 0x80041026, Facility: WMI
Description: Class has instances

An exception occurred during the Commit phase of the System.Management.Instrumentation.WMIManagementInstaller installer.
System.Management.Instrumentation.WmiProviderInstallationException: MOF Compilation failed
An exception occurred during the Commit phase of the installation. This exception will be ignored and installation will continue.


I have to do resolve this problem.
Here is my MOF file..
#pragma autorecover

#pragma namespace("\\\\.\\root")

instance of __Namespace
{
  Name = "cimv2";
};

#pragma namespace("\\\\.\\root\\cimv2")

class WMI_extension : __Win32Provider
{
	string Name = NULL;
	string CLSID = "{2A7B042D-578A-4366-9A3D-154C0498458E}";
	uint32 Version = 1;
	string HostingModel = "Decoupled:COM";
	string SecurityDescriptor = NULL;
	string AssemblyPath;
	string AssemblyName;
	string CLRVersion;
};

instance of WMI_extension
{
	AssemblyName = "AMIDiagProvider, Version=2.0.0.1, Culture=neutral, PublicKeyToken=5a8ca95a6684f5be";
	AssemblyPath = "file:///C:/Windows/Microsoft.Net/assembly/GAC_64/AMIDiagProvider/v4.0_2.0.0.1__5a8ca95a6684f5be/AMIDiagProvider.dll";
	CLRVersion = "v4.0.30319";
	CLSID = "{2A7B042D-578A-4366-9A3D-154C0498458E}";
	HostingModel = "LocalSystemHost:CLR";
	Name = "AMIDiagProvider, Version=2.0.0.1, Culture=neutral, PublicKeyToken=5a8ca95a6684f5be";
};

instance of __InstanceProviderRegistration
{
	provider = "Wmi_Extension.Name=\"AMIDiagProvider, Version=2.0.0.1, Culture=neutral, PublicKeyToken=5a8ca95a6684f5be\"";
	SupportsDelete = TRUE;
	SupportsEnumeration = TRUE;
	SupportsGet = TRUE;
	SupportsPut = TRUE;
};

instance of __MethodProviderRegistration
{
	provider = "Wmi_Extension.Name=\"AMIDiagProvider, Version=2.0.0.1, Culture=neutral, PublicKeyToken=5a8ca95a6684f5be\"";
};
[dynamic(TRUE) : ToInstance , provider("AMIDiagProvider, Version=2.0.0.1, Culture=neutral, PublicKeyToken=5a8ca95a6684f5be") , singleton(TRUE)]
class AMI_Win_QueryManager
{
	[read(TRUE)] string creationTime;
	[static(TRUE) , implemented(TRUE)] boolean ExecuteQuery([ID(0) , in(TRUE)] string XMLQuery,[ID(1) , out(TRUE)] string XMLResult);
};
Posted
Comments
Devel81 4-Mar-15 4:35am    
Did you ever fixed the problem? I have the same problem with a WMI Provider Extension. It worked great with .Net 3.5 but when changing to 4.0 it throws the same error when installing on Win 2k12 R2. Even a totally new WMI Provider Extension using .Net 4.0 throws this error.
Debojyoti Majumder 21-Apr-15 2:48am    
We re-wrote the module in .NET, at that point of time I have not found any good solution apart from that. The module was not so big and that's why I think I was able to do that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900