Time limit on ManagementScope.Connect?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • federico

    Time limit on ManagementScope.Connect?

    Hello, is there a way to limit the time a "ManagementScop e.Connect"
    execution takes to end before it times out by itself? I tried using
    ConnectionOptio ns.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 ConnectionOptio ns
    Dim query As ObjectQuery
    Dim searcher As ManagementObjec tSearcher
    Dim queryCollection As ManagementObjec tCollection
    Dim m As ManagementObjec t
    Dim scope As New ManagementScope ("\\" & oName & "\root\cimv 2", options)
    Try
    scope.Options.T imeout = New TimeSpan(200000 00)
    scope.Connect()
    Catch ex As System.Unauthor izedAccessExcep tion
    oMsg &= "Connect UnauthorizedAcc essException: " & ex.Message
    Exit Sub
    Catch ex As System.Runtime. InteropServices .COMException
    oMsg &= "Connect COMException: " & ex.Message
    Exit Sub
    End Try

    Regards,

    federico


Working...