# 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)
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

###### Who is Participating?

Commented:
What I would suggest doing is before calling connect chech for a ping reply
0

Commented:

see:
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.)

http://msdn.microsoft.com/en-us/library/system.management.connectionoptions_members.aspx
0

Author Commented:
OK?
so is there a way to limit the scope.Connect() time so my app does not just hang for what ever time?
0

Author Commented:
?hmm did not know i could do that, How do i do check for a ping reply
0
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.