LabWindows/CVI User Group Documents

Showing results for 
Search instead for 
Did you mean: 

How to get informations on the system through WMI in CVI (Windows Management Instrumentation)


This document describes how to use Win32 APIs to query system informations through WMI (Windows Management Instrumentation), a powerful tool that is installed on modern operating systems of the Windows family (starting from Windows ME on).

The amount of informations available through WMI is huge: this sample program demontrates how to approach this instrument by displaying some data about the operating system and the system enclosure. Make reference to microsoft documentation and to the interface to the Win32 API that comes with CVI for additional information.




While discouraging direct access to the Windows registry, Microsoft has added a set of functions to retrieve every type of informations you may need to know about the system your application is running on. WMI is a powerful instrument to get these data, but its access through CVI is not a trivial task.


This project is mainly taken tfrom example code that can be found within the Interface to Win32API that can be installed with CVI Full Development System, simply ported and adapted to CVI environment. Additional code samples can be found on Microsoft website.


Examples of data available through WMI are informations on the operating system and the system enclosure, some of which are retrieved in this example; informations on disks, mouse, files, networking, services and so on: the complete list is here on MSDN; the same informations are installed by CVI with the Interface to Win32 API.



Steps to Implement or Execute Code

The sample program is ready to go. It uses only standard functions included in the CVI installation. No additional tools are required to execute it.

The application is based on the Win32 Interface to the system APIs: it is well possible that it requires the Full Develpment System release of CVI to be executed. I have no Base package install available to test it against so I'm not sure, but I suppose WMI functions are not included in the base system.


Here a reproduction of the example window:

Screenshot 2017-05-11 12.36.11.png




CVI Full Development System release 2012 or later with support for Win32 API installed.

No additional tools needed.



No hardware is needed to run this example.




Added option to retrieve informations on network adapters

(2017) Added options to get power supply informations (useful when running on laptops) and disk infos

Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
If I have helped you, why not giving me a kudos?