managementscope.connect time out issue

i am having an issue with not being able to get the timeout option to work.
I want to set the time out for 1 min or so but to no avail to get it to work .
i have tried time span also (timespan(0,1,0)

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)
scope.Options.Timeout = New TimeSpan(20000000)
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

Who is Participating?
What I would suggest doing is before calling connect chech for a ping reply

Timeout Gets or sets the time-out to apply to the operation. Note that for operations that return collections, this time-out applies to the enumeration through the resulting collection, not the operation itself (the ReturnImmediately property is used for the latter). This property is used to indicate that the operation should be performed semisynchronously. (Inherited from ManagementOptions.) 
LeeHopkinsAuthor Commented:
so is there a way to limit the scope.Connect() time so my app does not just hang for what ever time?
LeeHopkinsAuthor Commented:
?hmm did not know i could do that, How do i do check for a ping reply
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.