I have some code that pings a system. If it's online, it checks what OS is on it. However, some systems randomly have problems with the WMI and will lock up my code. I need a way of setting some sort of at timeout so that it will skip to the next step if it sits for more than 10 seconds.
If PingComputer(strcomputer) = True Then
Dim ooss As Object
Dim sos As String
Dim OSTXT = ""
ooss = GetObject("winmgmts:\\" & strcomputer).InstancesOf("Win32_OperatingSystem")
For Each oos In ooss
sos = oos.Name
Dim pos As Integer
pos = InStr(sos, "|")
If pos Then
trimnull = Microsoft.VisualBasic.Left(sos, pos - 1)
sp = oos.ServicePackMajorVersion
OSTXT = trimnull & " SP " & sp
Catch ex As Exception