Initialize a ManagementClass variable with a ManagementClass constructor.
Imports System
Imports System.Management
Class Sample
Public Overloads Shared Function Main(ByVal args() As String) As Integer
Dim c As New ManagementClass("Win32_LogicalDisk")
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()
End Function
End Class
Related examples in the same category