WMI Timeout

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a list of workstations that I run WMI queries on from VB.NET. The
application works fine but can take a while because the list of computers is
long and many times there are workstations that are not turned on when WMI
tries to connect and eventually times out. Is there a way to adjust the
timeout? Or is there a good way inside VB.NET I can test to see if the
computer is active before attempting a WMI connection, such as a ping test?
 
Bishop,


Do you mean this one or is that the one you want to avoid?
It is not mine, however I changed some crazy things from it.

\\\
Function isAlive(ByVal host As String) As Boolean
Dim objStatus As ManagementObject
Dim objPing As New SelectQuery("Select StatusCode from
Win32_PingStatus " & _
"WHERE Address = '" & host & "' and statuscode = 0")
Dim Search As New ManagementObjectSearcher(objPing)
' because the hostname is unique, and statuscode=0 means "success",
we can just say
isAlive = (Search.Get.Count = 1)
Return isAlive
End Function
///
 
Back
Top