managementscope.connect time out issue

Posted on 2010-01-06
Medium Priority
Last Modified: 2013-11-08
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

Question by:LeeHopkins
  • 2
  • 2
LVL 13

Expert Comment

ID: 26190698

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

Author Comment

ID: 26190858
so is there a way to limit the scope.Connect() time so my app does not just hang for what ever time?
LVL 13

Accepted Solution

zadeveloper earned 500 total points
ID: 26190928
What I would suggest doing is before calling connect chech for a ping reply

Author Comment

ID: 26190998
?hmm did not know i could do that, How do i do check for a ping reply

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month17 days, 2 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question