Greetings. I am having trouble with the OLE ConnectServer method. I am calling this method within a loop, processing through about 25000 hosts, calling them via IP address. All is well except for 3 or 4 of these. For those, the method call does not return. I have to interrupt the script, remove the offending IP from the input stream, and then restart. The input IP's are all valid.

How do I handle this problem? Have I misread the Win32 documentation? To me it says that if I pass in 128 in the seventh position, the max wait will only be 2 minutes. Am I missing something in OLE?

I cannot fix the remote hosts. If this turns out to be an unavoidable problem in OLE, how do I best handle this in perl, enforcing my own timeout for the call?

Thanks.

my $ole = Win32::OLE->new('WbemScripting.SWbemLocator') or die "Can't start OLE"; # do some stuff to get a big list of ip addresses, hostnames, username +, and passwords foreach .... { # next if the ip does not ping... my $wmi = $ole->ConnectServer($ip, 'root/cimv2', $hostname.'\\'.$user, $pw, undef, undef, 128); # do some WQL stuff }

In reply to OLE ConnectServer method does not return by bigcreeklinn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.