Dear Monks..

I just got trained in Perl and i am asked to find out how to connect to a remote windows desktop (Windows Server 2003) from a windows machine (Windows XP Pro SP3) through Perl, researching on this for past one month but of no use. We have been doing this via Remote Desktop Connection for years (mstsc). There are a bunch of Go Grid servers and we log on to it using Remote Desktop and run Perl scripts there. Is it possible to do this through Perl - i.e. logging on to the Go Grid Server (of course its a WAN) with the IP, Username and Password. Then copying the script from local to server, if not possible, just run the scripts that are already there. I have been trying this with Net::SSH::Perl Module and Net::Telnet Module but it shows error. I'm not even sure whether these modules can be of help to me. Will paste the code and the errors anyways.

use Net::SSH::Perl; $scon = Net::SSH::Perl->new ("xx.xxx.xx.xx", port=>80); #$scon->login("username","password"); my($stdout, $stderr, $exit) = $ssh->cmd("foo"); $ssh->close;
Error: Connection closed by remote host at D:\remote.pl line 40
use Net::Telnet(); $telnet = new Net::Telnet ( Errmode=>'die', Prompt => '/\$ $/i'); $telnet->open(host=> 'xx.xxx.xx.xxx', Port => 80); $telnet->login('username', 'password'); print $telnet->cmd('who');
Error: timed-out waiting for login prompt at D:\remote.pl line 74

Please serve the needful. Thank You Monks!!!!!!!!!!!!

20100114 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips


In reply to Windows Remote Desktop In Perl by muralidharan

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.