You can do DCOM operations with Win32::OLE, you just have to specify the host you want to activate the object on: from the Win32::OLE documentation:

To create an object via DCOM on a remote server you can use an array reference in place of PROGID. The referenced array must contain the machine name and the program id or class id. For example:

my $obj = Win32::OLE->new(['my.machine.com', 'Program.Id']);

If the PROGID is a program id then Win32::OLE will try to resolve the corresponding class id locally. If the program id is not registered locally then the remote registry is queried. This will only succeed if the local process has read access to the remote registry. The safest (and fastest) method is to specify the class id directly.

As well as having the appropriate permissions to read the registry on the remote machine you also will need to set up the application security and identity on the remote machine using the dcomcnfg utility. It is important that you set the 'Identity' (i.e. the user that the remote application is run as) to one that has access to the appropriate resources for the application to run; you should also bear in mind that with COM activation the users default registry hive is not loaded so if you need access to settings stored in the users registry that user will need to be logged in to an interactive session on the machine, an alternative that I have used in the past is to create a dummy service that runs on the machine as the appropriate user, this will cause the registry hive to be kept open.

There are a lot of articles on MSDN about this for your further reading.

Update: another thing I forgot to point out is that you don't want to use $! to get the error message from the Win32::OLE but should use the Win32::OLE->LastError() class method as described in the documentation.

/J\


In reply to Re: Running Win32::OLe on Remote machine by gellyfish
in thread Running Win32::OLe on Remote machine by nisha

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.