Vb.net 使用系统管理对象

Vb.net 使用系统管理对象,vb.net,system.management,Vb.net,System.management,我写了这个程序: Public Function LipPCIsOn() As String ' Return TimeSpan.FromMilliseconds(System.Environment.TickCount).ToString() Dim query As New SelectQuery("SELECT LastBootUpTime FROM Win32_OperatingSystem WHERE Primary='true'") Dim searcher = New

我写了这个程序:

Public Function LipPCIsOn() As String
  '  Return TimeSpan.FromMilliseconds(System.Environment.TickCount).ToString()
  Dim query As New SelectQuery("SELECT LastBootUpTime FROM Win32_OperatingSystem WHERE Primary='true'")
  Dim searcher = New ManagementObjectSearcher(query)

  Dim ret As String = ""
  Dim mo As ManagementObject
  For Each mo In searcher.Get()
     Dim dtBootTime As DateTime = ManagementDateTimeConverter.ToDateTime(mo.Properties("LastBootUpTime").Value.ToString())
     ret = (Now - dtBootTime).ToString()
  Next

  Return ret
End Function
但我有一个错误:

SelectQuery is not defined
ManagementObjectSearcher is not defined
ManagementObject is not defined
我设置了这些导入:

Imports System
Imports System.Management
Imports System.Security
Imports System.IO
Imports System.IO.File
Imports System.IO.FileStream
Imports System.Windows.Forms
还需要什么吗?
谢谢

项目>添加参考>组件选项卡,勾选“系统管理”。谢谢,我已经注意到我的道歉