activeperl@listserv.activestate.com
[Top] [All Lists]

RE: Executing Remotely

Subject: RE: Executing Remotely
From: "Daniel Rychlik"
Date: Wed, 26 Apr 2006 12:20:21 -0500
I am checking into psexec now, and I will explore Win32::AdminMisc as a
possible engineered solution.

Thanks for all of your help
Dan

-----Original Message-----
From: activeperl-bounces@xxxxxxxxxxxxxxxxxxxxxxxx
[mailto:activeperl-bounces@xxxxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Ken
Cornetet
Sent: Wednesday, April 26, 2006 11:35 AM
To: activeperl@xxxxxxxxxxxxxxxxxxxxxxxx
Subject: RE: Executing Remotely

Psexec from sysinternals.

Here's some perl that uses Win32::AdminMisc routines to create a
scheduled job to run in 120 seconds. The caveat is that this runs as the
local machine account - it can't access remote files.

sub schedule {

        my $host = shift;
        my $file = shift;

        my $offset = CalcOffset($host);
# delta (seconds) of remote TZ
        if( $offset == -1 ) {
                $mesg .= "Could not calculate TZ delta for $host\n";
                return;
        }

        my $DOM = 0;
        my $DOW = 0;
        my $flags = JOB_ADD_CURRENT_DATE;
        my $cmd = $file;
        my $Time = Win32::AdminMisc::GetTOD("\\\\$host") + 120 +
$offset;
        my $job = Win32::AdminMisc::ScheduleAdd("\\\\$host", $Time,
$DOM, $DOW, $flags, $cmd);
}

########################################################################
##################
#
# Subroutine CalcOffset
# Calculates the number of seconds difference between the local time of
this system and
# the local time of the remote server.
#
########################################################################
##################

sub CalcOffset {

        my $remote = shift;
        my %info_local;
        my %info_remote;

        Win32::Lanman::NetRemoteTOD("", \%info_local) or return -1;
        Win32::Lanman::NetRemoteTOD($remote, \%info_remote) or return
-1;

        return 60 * ($info_local{timezone} - $info_remote{timezone});
}
 

-----Original Message-----
From: activeperl-bounces@xxxxxxxxxxxxxxxxxxxxxxxx
[mailto:activeperl-bounces@xxxxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Daniel
Rychlik
Sent: Wednesday, April 26, 2006 10:33 AM
To: $Bill Luebkert
Cc: activeperl@xxxxxxxxxxxxxxxxxxxxxxxx
Subject: RE: Executing Remotely

So there is no real easy way to execute programs or batch files from
PERL...  We would have to physically touch all 2000 servers to execute
these upgrade scripts...  

Hmmm... has to be a better way.


-----Original Message-----
From: $Bill Luebkert [mailto:dbecoll@xxxxxxxxxxxx]
Sent: Monday, April 24, 2006 8:30 PM
To: Daniel Rychlik
Cc: activeperl@xxxxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Executing Remotely

Daniel Rychlik wrote:

> How would one execute a batch or executable on a remote computer using

> PERL?

rsh or ssh or a server running on the remote computer (eg: web server
w/CGI interface, SNMP, etc) - lots of ways depending on your needs.

_______________________________________________
ActivePerl mailing list
ActivePerl@xxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
ActivePerl@xxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
ActivePerl@xxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

<Prev in Thread] Current Thread [Next in Thread>