這篇文章給大家分享的是有關(guān)VB.NET如何調(diào)用WMI來實現(xiàn)系統(tǒng)管理和系統(tǒng)信息查詢的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
10年積累的做網(wǎng)站、網(wǎng)站建設(shè)經(jīng)驗,可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認識你,你也不認識我。但先網(wǎng)站制作后付款的網(wǎng)站建設(shè)流程,更有羅山免費網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
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”并在實例代碼中導(dǎo)入引用的項目和程序集中定義的命名空間或編程元素 即: 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)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!