Communication between WMI and Windows services

2019-06-09 12:39发布

I have created a WMI application(in C++) which query what type of OS is there in the remote system. I used the following reference : http://msdn.microsoft.com/en-us/library/aa390422%28v=vs.85%29.aspx

I have created a Windows Service(in C++) on the remote PC. Now I wont to connect my WMI application to the Windows services. I have read about the WMI Provides but I am not actually understanding how to use them to create my WMI classes :(.

Can anyone provide me any information on how to proceed ?

Thanks in advance, Sid

1条回答
淡お忘
2楼-- · 2019-06-09 12:45

I got how to proceed with this. I need to create a WMI provider ( dll + MOF file).

I need to create a MOF(managed Object File) which consist of CIM classes and Events. In this MOF file I need to create a WMI namespace ( e.g., #pragma namespace("\\.\Root") ).
After this I need to compile the MOF file file using "mofcomp.exe"so that the CIM classes in the MOF file goes to the WMI repository.

Now inside the dll file I need to use the ConnectServer() function to connect to this new WMI namespace ("\\.\Root").

I referred this link
http://www.codeproject.com/Articles/27914/WMI-MOF-Basics

查看更多
登录 后发表回答