Search code examples
winapiwmi

WMI vs Windows APIs


There are any advantages or disadvantages of using the WMI instead of Windows API to access to the information of the system? as speed, additional permissions, memory usage.

or depends on the WMI class and how the WMI implements the access to the information?


Solution

  • The main disadvantage of WMI is speed, it is slow to query data and if you are trying to use it during start up it can delay you starting as the WMI service takes a long time to come up.

    However, WMI information is richer, as in you need to sometimes make several API calls to get the same amount, some information is a lot easier to get at and the filtering syntax can dramatically reduce the amount code you have to write.

    If speed isn't a massive issue, I would always lean towards WMI.