Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

execute remote commands Windowz

by boat73 (Scribe)
on Dec 17, 2003 at 13:36 UTC ( [id://315265]=perlquestion: print w/replies, xml ) Need Help??

boat73 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to find a perl module that might allow me to execute remote commands on a windowz machine. I know about psexec but would prefer to use perl. Does anyone know of anything out there that might head me in the right direction. Thanks in advance.

Replies are listed 'Best First'.
Re: execute remote commands Windowz
by rchiav (Deacon) on Dec 17, 2003 at 14:42 UTC
    You can use Win32::OLE and WMI to create remote processes. A quick google returned this which should give you an example. (note: the post is about creating a process not working, but the response shows working examples).

      Hi,
      rchiav's link shows how to create a new process - you can get the remote workstations 'handle' as follows.

      #In a "Workstation" module... sub get_wmi { my $self = shift; my $name = $self->name or do { warn("Cannot return WMI handle for anonymous workstati +on.\n"); return 0; }; use Win32::OLE ; my $wmi = Win32::OLE->GetObject( "winmgmts:{impersonationLevel +=impersonate,(security)}//$name"); if ($wmi) { return $wmi; }else{ return 0; } }

      You can then use that handle to start/stop processes on remote machines or list shares etc.

      - Mark
Re: execute remote commands Windowz
by Plankton (Vicar) on Dec 17, 2003 at 16:05 UTC
    You could always get some version of ssh that runs on Windows. Try looking here

    Plankton: 1% Evil, 99% Hot Gas.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://315265]
Approved by Plankton
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-04-24 12:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found