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