Advertisement
Advertisement
| 07.18.2008 at 09:11AM PDT, ID: 23577315 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: |
Imports System
Imports System.Management
Imports System.Windows.Forms
Namespace WMIState
Public Class WMIStateQuery
Public Overloads Shared Function Main() As Integer
Try
Dim host() as string = {"B001279AE624B", "B001E0BA97371"}
Dim searcher As New ManagementObjectSearcher( _
"\\" & host() & "\root\CIMV2", _
"SELECT State FROM Win32_Service Where Name = 'Platform Validation Tool'")
Dim i as Integer
For i = 0 To host.Length - 1
Console.WriteLine("Computer: {0}", host)
For Each queryObj As ManagementObject in searcher.Get()
Console.WriteLine("-----------------------------------")
Console.WriteLine("Win32_Service instance")
Console.WriteLine("-----------------------------------")
Console.WriteLine("State: {0}", queryObj("State"))
Next
Next
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
End Try
End Function
End Class
End Namespace
|