This How-to shows how to use System.Management to incorporate WMI calls. The application has tabs demonstrating three different uses of WMI:
1. WMI Queries. This shows how to use the ManagementObjectSearcher class to query the following system information: Operating System Name, Version, Manufacturer, Computer name, and Windows Directory; Computer System Manufacturer, Model, System Type, and Total Physical Memory; Processor name; Bios version; and Time zone. Queries are created both using the SelectQuery class and by the WQL string version.
2. Asynchronous Enumerations. In many cases WMI is used to retrieve large quantities of data. In these situations it is important that the operation is done asynchronously, allowing the user interface, and other ongoing processes to continue. This demonstrates how to get a list of logical drives and their properties asynchronously using the ManagementOperationObserver class, with a callback event.
3. WMI Classes. This shows how to enumerate through the top-level WMI classes and all of their subclasses using the ManagementClass and EnumerationOptions classes.
Microsoft Visual Studio.NET Professional or greater.
Windows 2000 or Windows XP.
Simply press F5.
See Also