none
Create WMI IWbemServices with CoCreateInstanceEx RRS feed

  • Question

  • I try to create a remote management tool using WMI, and I am curious why I can not use CoCreateInstanceEx to create IWbemServices? I can not find IWbemServices' CLSID anywhere.

    My questions are,
    1. What is IWbemServices' CLSID?
    2. Can I use CoCreateInstanceEx to create IWbemServices on a client computer?
    3. What is the reason of using IWbemLocator to create IWbemServices?

    Thanks for your help,

    HW

    Friday, August 22, 2008 5:47 PM

Answers

  • IWbemServices is an interface.  You'd have to create a coclass first that implements IWbemLocator and call it's ConnectServer method to get the interface pointer.  Like CLSID_WbemAdministrativeLocator. 

    No need to monkey with these poorly documented COM interfaces when you've got the System.Management namespace.

    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Tuesday, August 26, 2008 11:34 AM
    Saturday, August 23, 2008 1:38 AM
    Moderator