397,636 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 397,636 IT Pros & Developers. It's quick & easy.

WMI ConnectionOptions with Timeout.

DKn
P: 53
Hello all,

How this Timeout option is useful ?

When i am going for WMI connection i have given this Timeout option , Still for connection is taking 5 to 6 seconds.
ConnectionOptions.Timeout = new TimeSpan(0, 0, 2);

Actually in this case, According to my knowledge on TimeOut property ,It should get WMI connection success or failure with in 2 seconds, but still it is taking time up to 5 seconds.

With out this timeout option also observed the same time taken for WMI connection.

Please any one tell me, In which respective the timeout option will be useful.
Oct 13 '08 #1
Share this Question
Share on Google+
4 Replies


PRR
Expert 100+
P: 750
PRR
Hello all,

How this Timeout option is useful ?

When i am going for WMI connection i have given this Timeout option , Still for connection is taking 5 to 6 seconds.
ConnectionOptions.Timeout = new TimeSpan(0, 0, 2);

Actually in this case, According to my knowledge on TimeOut property ,It should get WMI connection success or failure with in 2 seconds, but still it is taking time up to 5 seconds.

With out this timeout option also observed the same time taken for WMI connection.

Please any one tell me, In which respective the timeout option will be useful.
WMI connection specially to remote computer takes time... quite a few seconds... i guess 2 secs is way to less....
Timeout MSDN
Acc to MSDN ...timeout property (remember its ManagementOptions.Timeout Property ... inherited)
"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)"

i guess... connection failure or server not found in WMI... for remote PC... there is more than one attempt to establish a connection .. before timing out...
Oct 13 '08 #2

PRR
Expert 100+
P: 750
PRR
"The ManagementOptions.Timeout property is intended for WMI semi-sync
operations. In particular, the ConnectionOption.Timeout property is not used
to control the timeout for a WMI connection. This is because the underlying
WMI COM API doesn't support specifying a timeout value. The timeout value is
default to the value DCOM specifies (usually 60secs). You can adjust this
value via dcomcnfg.exe. "
Andy Cheung

i guess you could first establish that the client exists .. Ping
then you could try n connect to the remote pc..
Run dcomcnfg.exe-> Go to mycomputer properties -> options-> tansaction timeout..
Oct 13 '08 #3

DKn
P: 53
DKn
"The ManagementOptions.Timeout property is intended for WMI semi-sync
operations. In particular, the ConnectionOption.Timeout property is not used
to control the timeout for a WMI connection. This is because the underlying
WMI COM API doesn't support specifying a timeout value. The timeout value is
default to the value DCOM specifies (usually 60secs). You can adjust this
value via dcomcnfg.exe. "
Andy Cheung

i guess you could first establish that the client exists .. Ping
then you could try n connect to the remote pc..
Run dcomcnfg.exe-> Go to mycomputer properties -> options-> tansaction timeout..
Hi,
Thanks for you reply.

I changed that Transaction timeout under dcomcnfg from 60 sec to 10 sec.
Then I tried to test whether this change is effecting or not.
Purposely I tried to connect to the non existing host which will take more time.
Still the WMIScope.Connect() method is taking around 45 sec to execute.
It should come out with in 10 sec right? Please give some input. I don't want to wait until the default time as you said 60 sec..
Oct 13 '08 #4

PRR
Expert 100+
P: 750
PRR
Hi,
Thanks for you reply.

I changed that Transaction timeout under dcomcnfg from 60 sec to 10 sec.
Then I tried to test whether this change is effecting or not.
Purposely I tried to connect to the non existing host which will take more time.
Still the WMIScope.Connect() method is taking around 45 sec to execute.
It should come out with in 10 sec right? Please give some input. I don't want to wait until the default time as you said 60 sec..
non existing host?? i guess its becoz the connection attempt is made more than once... besides i guess the timeout time of 60 sec ... possibly cannot be reduced...(as far as i know)...
you could establish first that the client exists and then "know" that all your clients OS support WMI .. After that you could connect?
Oct 13 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.