本文整理汇总了VB.NET中System.Management.ManagementClass.ManagementClass构造函数的典型用法代码示例。如果您正苦于以下问题:VB.NET ManagementClass构造函数的具体用法?VB.NET ManagementClass怎么用?VB.NET ManagementClass使用的例子?那么, 这里精选的构造函数代码示例或许可以为您提供帮助。
在下文中一共展示了ManagementClass构造函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Sample
' 导入命名空间
Imports System.Management
Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Get the WMI class
Dim processClass As New ManagementClass
processClass.Path = New _
ManagementPath("Win32_Process")
' Get the methods in the class
Dim methods As MethodDataCollection
methods = processClass.Methods
' display the methods
Console.WriteLine("Method Names: ")
For Each method As MethodData In methods
Console.WriteLine(method.Name)
Next
Console.WriteLine()
' Get the properties in the class
Dim properties As PropertyDataCollection
properties = processClass.Properties
' display the properties
Console.WriteLine("Property Names: ")
For Each p As PropertyData In properties
Console.WriteLine(p.Name)
Next
Console.WriteLine()
' Get the Qualifiers in the class
Dim qualifiers As QualifierDataCollection = _
processClass.Qualifiers()
' display the qualifiers
Console.WriteLine("Qualifier Names: ")
For Each qualifier As QualifierData In qualifiers
Console.WriteLine(qualifier.Name)
Next
End Function
End Class
示例2: Sample
' 导入命名空间
Imports System.Management
Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Get the WMI class
Dim c As New ManagementClass( _
New ManagementPath("Win32_LogicalDisk"))
' Get the methods in the class
Dim methods As MethodDataCollection
methods = c.Methods
' display the methods
Console.WriteLine("Method Names: ")
For Each method As MethodData In methods
Console.WriteLine(method.Name)
Next
Console.WriteLine()
' Get the properties in the class
Dim properties As PropertyDataCollection
properties = c.Properties
' display the properties
Console.WriteLine("Property Names: ")
For Each p As PropertyData In properties
Console.WriteLine(p.Name)
Next
Console.WriteLine()
' Get the Qualifiers in the class
Dim qualifiers As QualifierDataCollection = _
c.Qualifiers()
' display the qualifiers
Console.WriteLine("Qualifier Names: ")
For Each qualifier As QualifierData In qualifiers
Console.WriteLine(qualifier.Name)
Next
End Function
End Class
示例3: Sample
' 导入命名空间
Imports System.Management
Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Get the WMI class
Dim c As New ManagementClass("Win32_LogicalDisk")
' Get the methods in the class
Dim methods As MethodDataCollection
methods = c.Methods
' display the methods
Console.WriteLine("Method Names: ")
For Each method As MethodData In methods
Console.WriteLine(method.Name)
Next
Console.WriteLine()
' Get the properties in the class
Dim properties As PropertyDataCollection
properties = c.Properties
' display the properties
Console.WriteLine("Property Names: ")
For Each p As PropertyData In properties
Console.WriteLine(p.Name)
Next
Console.WriteLine()
' Get the Qualifiers in the class
Dim qualifiers As QualifierDataCollection = _
c.Qualifiers()
' display the qualifiers
Console.WriteLine("Qualifier Names: ")
For Each qualifier As QualifierData In qualifiers
Console.WriteLine(qualifier.Name)
Next
End Function
End Class
示例4: Sample
' 导入命名空间
Imports System.Management
Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Get the WMI class
Dim p As New ManagementPath("Win32_Process")
' Options specify that amended qualifiers
' are to be retrieved along with the class
Dim o As New ObjectGetOptions( _
Nothing, System.TimeSpan.MaxValue, True)
Dim c As New ManagementClass(p, o)
' Get the methods in the class
Dim methods As MethodDataCollection
methods = c.Methods
' display the methods
Console.WriteLine("Method Names: ")
For Each method As MethodData In methods
Console.WriteLine(method.Name)
Next
Console.WriteLine()
' Get the properties in the class
Dim properties As PropertyDataCollection
properties = c.Properties
' display the properties
Console.WriteLine("Property Names: ")
For Each pdata As PropertyData In properties
Console.WriteLine(pdata.Name)
Next
Console.WriteLine()
' Get the Qualifiers in the class
Dim qualifiers As QualifierDataCollection = _
c.Qualifiers()
' display the qualifiers
Console.WriteLine("Qualifier Names: ")
For Each qualifier As QualifierData In qualifiers
Console.WriteLine(qualifier.Name)
Next
End Function
End Class
示例5: Sample
' 导入命名空间
Imports System.Management
Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Get the WMI class
' Options specify that amended qualifiers
' should be retrieved along with the class
Dim o As New ObjectGetOptions( _
Nothing, System.TimeSpan.MaxValue, True)
Dim c As New ManagementClass("Win32_ComputerSystem", o)
' Get the methods in the class
Dim methods As MethodDataCollection
methods = c.Methods
' display the methods
Console.WriteLine("Method Names: ")
For Each method As MethodData In methods
Console.WriteLine(method.Name)
Next
Console.WriteLine()
' Get the properties in the class
Dim properties As PropertyDataCollection
properties = c.Properties
' display the properties
Console.WriteLine("Property Names: ")
For Each p As PropertyData In properties
Console.WriteLine(p.Name)
Next
Console.WriteLine()
' Get the Qualifiers in the class
Dim qualifiers As QualifierDataCollection = _
c.Qualifiers()
' display the qualifiers
Console.WriteLine("Qualifier Names: ")
For Each qualifier As QualifierData In qualifiers
Console.WriteLine(qualifier.Name)
Next
End Function
End Class
示例6: Sample
' 导入命名空间
Imports System.Management
Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Get the WMI class
Dim s As New ManagementScope("\\MyBox\root\cimv2")
Dim p As New ManagementPath("Win32_Environment")
Dim o As New ObjectGetOptions( _
Nothing, System.TimeSpan.MaxValue, True)
Dim c As New ManagementClass(s, p, o)
' Get the methods in the class
Dim methods As MethodDataCollection
methods = c.Methods
' display the methods
Console.WriteLine("Method Names: ")
For Each method As MethodData In methods
Console.WriteLine(method.Name)
Next
Console.WriteLine()
' Get the properties in the class
Dim properties As PropertyDataCollection
properties = c.Properties
' display the properties
Console.WriteLine("Property Names: ")
Dim data As PropertyData
For Each data In properties
Console.WriteLine(data.Name)
Next
Console.WriteLine()
' Get the Qualifiers in the class
Dim qualifiers As QualifierDataCollection = _
c.Qualifiers()
' display the qualifiers
Console.WriteLine("Qualifier Names: ")
For Each qualifier As QualifierData In qualifiers
Console.WriteLine(qualifier.Name)
Next
End Function
End Class
示例7: Sample
' 导入命名空间
Imports System.Management
Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Get the WMI class
' Options specify that amended qualifiers
' should be retrieved along with the class
Dim c As New ManagementClass("\\MyBox\root\cimv2", _
"Win32_Environment", _
New ObjectGetOptions( _
Nothing, System.TimeSpan.MaxValue, True))
' Get the methods in the class
Dim methods As MethodDataCollection
methods = c.Methods
' display the methods
Console.WriteLine("Method Names: ")
For Each method As MethodData In methods
Console.WriteLine(method.Name)
Next
Console.WriteLine()
' Get the properties in the class
Dim properties As PropertyDataCollection
properties = c.Properties
' display the properties
Console.WriteLine("Property Names: ")
For Each p As PropertyData In properties
Console.WriteLine(p.Name)
Next
Console.WriteLine()
' Get the Qualifiers in the class
Dim qualifiers As QualifierDataCollection = _
c.Qualifiers()
' display the qualifiers
Console.WriteLine("Qualifier Names: ")
For Each qualifier As QualifierData In qualifiers
Console.WriteLine(qualifier.Name)
Next
End Function
End Class