Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Windows remote login

by Jagan (Initiate)
on Nov 29, 2011 at 10:56 UTC ( #940580=perlquestion: print w/replies, xml ) Need Help??
Jagan has asked for the wisdom of the Perl Monks concerning the following question:

I need to remote login into a windows machine and run some commands on it. Later I need to copy some files from it to my windows machine. How can I do it using perl script? Rightnow , i am doing mstsc . Sharing the files and then copying it on my system.

Replies are listed 'Best First'.
Re: Windows remote login
by ww (Archbishop) on Nov 29, 2011 at 11:58 UTC
    $ perl where
    1. connects (via Modem, LAN, telepathy?) to the Win box;
    2. logs in;
    3. executes (that's a hint, sort of) some Win built-ins and
    4. concludes with a process to find and download your selected files.

    Unless its going to be the same Win machine, the same commands and same files to download on each run of your script, you'll probably want to provide some way to tell the script the "which" or "where" of each of the preceeding.

    Sorry, but when your write "How can I do it using perl script?," you appear to be asking us to write the script. We don't do that (in theory, anyhow); we'll be happy to help you learn, if you demonstrate some desire to do so, and provide some evidence that you've made an effort to write your own program.

    Come back with an update on what you've worked out and the problem that still has you stuck: then, you'll find lots of willing help. Otherwise, hire a programmer.

      Thanks. I will try and get back to you.
Re: Windows remote login
by TJPride (Pilgrim) on Nov 29, 2011 at 12:42 UTC
    You could theoretically set up SSH/SFTP on the windows machine, log in via Net::SSH::Perl or Net::SSH from your other computer and run the commands, then log in via Net::SFTP or Net::SFTP::Foreign and copy the files as necessary. Just make sure to secure the access for a specific IP range, directory, list of commands, etc.
Re: Windows remote login
by sundialsvc4 (Abbot) on Nov 29, 2011 at 13:23 UTC

    A Windows batch-job processing monitor might be more appropriate.   After all, what you want to achieve is that a remote computer is sent work-to-do and the results are then sent back to you.

    link-1   link-2   link-3

      Thanks for you reply. I will try this.
Re: Windows remote login
by ChuckularOne (Parson) on Nov 29, 2011 at 17:28 UTC

    In a situation like that I would use samba. I have done some elaborate samba coding in perl in the past.

    You might want to check cpan for a module to simplify the transfers. Make sure to find one that handles errors as (in my experience) samba does not have very good native error handling.

Re: Windows remote login
by NetWallah (Canon) on Nov 30, 2011 at 04:15 UTC
    Sysinternals/Microsoft psExec and using a UNC path to access remote files should fill your requirements.

                "XML is like violence: if it doesn't solve your problem, use more."

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://940580]
Approved by marto
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2018-06-19 16:05 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (114 votes). Check out past polls.