Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How VB.NET calls WMI to realize system management and system information query

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how VB.NET calls WMI to implement system management and system information query. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

VB.Net calls WMI to realize system management and system information query and so on. The full name of WMI is Windows Management Instrumentation, and we can achieve many system management functions with WMI. Msdn is relatively simple to describe this in the .net Framework class library (because early WMI-related topics are described in more detail, it is not explained and demonstrated in detail in the class library).

Development environment: VB2005 Windows2003

This example requires "Project"-"add reference"-"System.Management" in the menu bar and import the namespaces or programming elements defined in the referenced project and assembly, namely: Imports System.Management, in the example code.

An example of VB.NET instance tutorial's VB.NET query system startup information

The code is as follows:

Private Sub Lobdotcn () Dim Lob_Searcher As New ManagementObjectSearcher ("root\ CIMV2" "SELECT * FROM Win32_BootConfiguration") For Each Obj_Query As ManagementObject In Lob_Searcher.Get () ListBox1.Items.Add ("Organization of LOB.Cn VB.Net enthusiasts") ListBox1.Items.Add ("BootDirectory:" & Obj_Query ("BootDirectory")) ListBox1.Items.Add ("Caption:" & Obj_Query ("Caption") ListBox1.Items.Add ("ConfigurationPath:" & Obj_Query ("ConfigurationPath")) ) ListBox1.Items.Add ("Description:" & Obj_Query ("Description") ListBox1.Items.Add ("LastDrive:" & Obj_Query ("LastDrive")) ListBox1.Items.Add ("Name:" & Obj_Query ("Name")) ListBox1.Items.Add ("ScratchDirectory:" & Obj_Query ("ScratchDirectory")) ListBox1.Items.Add ("SettingID:" & Obj_Query ("SettingID")) ListBox1.Items .add ("TempDirectory:" & Obj_Query ("TempDirectory")) Next End Sub

Description of related attributes:

BootDirectory Data type: string Access type: Read-only Path to the system files required for booting the system. Example: "C:\ Windows" Caption Data type: string Access type: Read-only Qualifiers: MaxLen (64) Short description (one-line string) of the CIM_Setting object. This property is inherited from CIM_Setting. ConfigurationPath Data type: string Access type: Read-only Path to the configuration files. This value may be similar to the value in the BootDirectory property. Description Data type: string Access type: Read-only Description of the CIM_Setting object. This property is inherited from CIM_Setting. LastDrive Data type: string Access type: Read-only Last drive letter to which a physical drive is assigned. Example: "E:" Name Data type: string Access type: Read-only Qualifiers: Key, MaxLen. Name of the boot configuration. It is an identifier for the boot configuration. ScratchDirectory Data type: string Access type: Read-only Directory where temporary files can reside during boot time. SettingID Data type: string Access type: Read-only Qualifiers: MaxLen. Identifier by which the CIM_Setting object is known. This property is inherited from CIM_Setting. TempDirectory Data type: string Access type: Read-only Directory where temporary files are stored. Example: "C:\ TEMP" Thank you for reading! On "VB.NET how to call WMI to achieve system management and system information query" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report