您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關VB.NET如何調用WMI來實現系統管理和系統信息查詢的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
VB.Net調用WMI可以實現系統管理和系統信息查詢等。WMI全稱為Windows Management Instrumentation,利用WMI我們可以實現很多系統管理的功能,msdn在.Net Framework類庫中對此描述比較簡單(因為早期WMI相關專題有所較詳盡描述,故類庫中未再詳細解說與演示)。
開發環境: VB2005 Windows2003
本實例需要在菜單欄中的“項目”-“ 添加引用” -“ System.Management”并在實例代碼中導入引用的項目和程序集中定義的命名空間或編程元素 即: Imports System.Management
VB.NET實例教程之VB.NET查詢系統啟動信息的實例
代碼如下:
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("樂博網LOB.Cn VB.Net愛好者的組織") 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
相關屬性說明:
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(256) 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(256) 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"
感謝各位的閱讀!關于“VB.NET如何調用WMI來實現系統管理和系統信息查詢”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。