VB.NET实例教程之查询系统启动信息案例剖析
创始人
2024-06-09 14:30:47
0

在网上看到大家对VB.Net调用WMI实现系统管理都很感兴趣,在此呢VB实例教程来教你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查询系统启动信息的实例

代码如下:

  1. Private Sub Lobdotcn()  
  2. Dim Lob_Searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_BootConfiguration")  
  3. For Each Obj_Query As ManagementObject In Lob_Searcher.Get()  
  4. ListBox1.Items.Add("乐博网LOB.Cn   VB.Net爱好者的组织")  
  5. ListBox1.Items.Add("BootDirectory: " & Obj_Query("BootDirectory"))  
  6. ListBox1.Items.Add("Caption: " & Obj_Query("Caption"))  
  7. ListBox1.Items.Add("ConfigurationPath: " & Obj_Query("ConfigurationPath"))  
  8. ListBox1.Items.Add("Description: " & Obj_Query("Description"))  
  9. ListBox1.Items.Add("LastDrive: " & Obj_Query("LastDrive"))  
  10. ListBox1.Items.Add("Name: " & Obj_Query("Name"))  
  11. ListBox1.Items.Add("ScratchDirectory: " & Obj_Query("ScratchDirectory"))  
  12. ListBox1.Items.Add("SettingID: " & Obj_Query("SettingID"))  
  13. ListBox1.Items.Add("TempDirectory: " & Obj_Query("TempDirectory"))  
  14. Next  
  15. End Sub 


相关属性说明:

  1. BootDirectory   
  2. Data type: string  
  3. Access type: Read-only   
  4. Path to the system files required for booting the system.  
  5. Example: "C:\Windows"  
  6. Caption   
  7. Data type: string  
  8. Access type: Read-only  
  9. Qualifiers: MaxLen(64)   
  10. Short description (one-line string) of the CIM_Setting object. This property is inherited from CIM_Setting.  
  11. ConfigurationPath   
  12. Data type: string  
  13. Access type: Read-only   
  14. Path to the configuration files. This value may be similar to the value in the BootDirectory property.  
  15. Description   
  16. Data type: string  
  17. Access type: Read-only   
  18. Description of the CIM_Setting object. This property is inherited from CIM_Setting.  
  19. LastDrive   
  20. Data type: string  
  21. Access type: Read-only   
  22. Last drive letter to which a physical drive is assigned.  
  23. Example: "E:"  
  24. Name   
  25. Data type: string  
  26. Access type: Read-only  
  27. Qualifiers: Key, MaxLen(256)   
  28. Name of the boot configuration. It is an identifier for the boot configuration.  
  29. ScratchDirectory   
  30. Data type: string  
  31. Access type: Read-only   
  32. Directory where temporary files can reside during boot time.  
  33. SettingID   
  34. Data type: string  
  35. Access type: Read-only  
  36. Qualifiers: MaxLen(256)   
  37. Identifier by which the CIM_Setting object is known. This property is inherited from CIM_Setting.  
  38. TempDirectory   
  39. Data type: string  
  40. Access type: Read-only   
  41. Directory where temporary files are stored.  
  42. Example: "C:\TEMP" 

以上就是VB.NET实例教程中VB.NET查询系统启动信息的实例讲解,以后还会对VB.NET很多问题进行讲解,希望即时关注。

【编辑推荐】

  1. 剖析VB.NET平台调用是如何执行操作
  2. 分享个人总结VB.NET多线程
  3. 详细说明VB.NET变量中四点
  4. 三类十二种VB.NET数据类型全面介绍
  5. VB.NET初步知识,初学者必看

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...
德国电信门户网站可实时显示全球... 德国电信周三推出一个门户网站,直观地实时提供其安装在全球各地的传感器网络检测到的网络攻击状况。该网站...
为啥国人偏爱 Mybatis,... 关于 SQL 和 ORM 的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行...
《非诚勿扰》红人闫凤娇被曝厕所... 【51CTO.com 综合消息360安全专家提醒说,“闫凤娇”、“非诚勿扰”已经被黑客盯上成为了“木...
2012年第四季度互联网状况报... [[71653]]  北京时间4月25日消息,据国外媒体报道,全球知名的云平台公司Akamai Te...