Are you sure that the code posted is the code that you ran? The reason for asking is that I see your posted code is doing two things: a) loading modules and pragmas; and b) defining a subroutine. Unless I missed it somewhere, you didn't call the subroutine in your posted code.

Assuming that your actual code is calling the subroutine and it really is crashing the script, you might try encasing the call of the subroutine and/or that particular line of code checking the registry path inside an eval block to help trap the error and possibly get more details on the error.

One more thought. You mentioned that you wanted to "check for a registry value on a remote machine via WMI". I personally haven't done much with WMI, but generally speaking you need to provide credentials to access a remote system. If two Windows systems have local user accounts with identical username and password, you might be able to get by without supplying credentials since Windows will try you're logged in with on the local machine when accessing remote systems. Anyways, I'm not seeing credential information in your posted code, which might be a contributing factor.

One other thing that I'd check is to see if the remote registry service on the remote system is running. (Not sure if WMI utilizes that service or not.) Also, you might want to check firewall settings on the remote system.


In reply to Re: Win32::OLE lookup registry value on remote machine via WMI by dasgar
in thread Win32::OLE lookup registry value on remote machine via WMI by yankaxc

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.