F
federico
Hello, is there a way to limit the time a "ManagementScope.Connect"
execution takes to end before it times out by itself? I tried using
ConnectionOptions.TimeOut property to no avail.
I am trying with the code below to scan a group of computers, but there are
still a few computers that take way more than two seconds to time out.
Please, any help or pointers will be greatly appreciated.
Dim options As New ConnectionOptions
Dim query As ObjectQuery
Dim searcher As ManagementObjectSearcher
Dim queryCollection As ManagementObjectCollection
Dim m As ManagementObject
Dim scope As New ManagementScope("\\" & oName & "\root\cimv2", options)
Try
scope.Options.Timeout = New TimeSpan(20000000)
scope.Connect()
Catch ex As System.UnauthorizedAccessException
oMsg &= "Connect UnauthorizedAccessException: " & ex.Message
Exit Sub
Catch ex As System.Runtime.InteropServices.COMException
oMsg &= "Connect COMException: " & ex.Message
Exit Sub
End Try
Regards,
federico
execution takes to end before it times out by itself? I tried using
ConnectionOptions.TimeOut property to no avail.
I am trying with the code below to scan a group of computers, but there are
still a few computers that take way more than two seconds to time out.
Please, any help or pointers will be greatly appreciated.
Dim options As New ConnectionOptions
Dim query As ObjectQuery
Dim searcher As ManagementObjectSearcher
Dim queryCollection As ManagementObjectCollection
Dim m As ManagementObject
Dim scope As New ManagementScope("\\" & oName & "\root\cimv2", options)
Try
scope.Options.Timeout = New TimeSpan(20000000)
scope.Connect()
Catch ex As System.UnauthorizedAccessException
oMsg &= "Connect UnauthorizedAccessException: " & ex.Message
Exit Sub
Catch ex As System.Runtime.InteropServices.COMException
oMsg &= "Connect COMException: " & ex.Message
Exit Sub
End Try
Regards,
federico