I second the recommendation of psexec. It is a great tool, and I've used
it many times.

On the other hand, you can do what you want to do (provided that running
the remote process under the system security context is ok) is to use
the scheduling service.

This code schedules a command to run 120 seconds in the future. You can
probably reduce it.

sub schedule {

        my $host = shift;
        my $cmd = 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 $Time = Win32::AdminMisc::GetTOD("\\\\$host") + 120 +
$offset;
        my $job = Win32::AdminMisc::ScheduleAdd("\\\\$host", $Time,
$DOM, $DOW, $flags, $cmd);
        $mesg .= "Scheduled Job: $job  Cmd: $cmd   Host: $host  Time: "
. scalar localtime($Time) . "\n";
}

########################################################################
##################
#
# 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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Howard
Tanner
Sent: Wednesday, April 20, 2005 6:28 PM
To: 'Hemphill, Barry'
Cc: [email protected]
Subject: RE: Starting process on remote machine


Barry,

The best I can give you is not a Perl solution, but it's a freeware tool
from the Windows guru's at www.sysinternals.com. It's called PsExec, and
it can run a command on a remote windows machine (if you have authority
on that machine). This should be able to run Outlook on that remote
machine, but of course, you will not be able to control Outlook, so I'm
not sure if this suits your need.

You can download the tool from:
http://www.sysinternals.com/ntw2k/freeware/psexec.shtml

A good article on how to use it (by the author, Mark Russinovich) can be
found here:
http://www.windowsitpro.com/Windows/Article/ArticleID/42919/42919.html

PsExec is actually part of a larger suite of command line tools called
PsTools, most of which are extremely handy. PsTools info is here:
http://www.sysinternals.com/ntw2k/freeware/pstools.shtml

HTH,
HT

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Hemphill, Barry
Sent: Wednesday, April 20, 2005 5:36 PM
To: [email protected]
Subject: RE: Starting process on remote machine

> -----Original Message-----
> From: David Nicol [mailto:[EMAIL PROTECTED]
> 
> On 4/20/05, Hemphill, Barry <[EMAIL PROTECTED]> wrote:
> 
> > The main requirement is that we can not install any code on the
remote
> > systems.
> 
> then you're dead in the water and the best thing to do is walk out 
> immediately. Any technology that could do what you are asking would be

> a powerful intrusion tool (like "backorifice") and would be an 
> unacceptable security risk which would hopefully be disabled in a 
> security update lickety-split.

David,

I appreciate the comments, but I don't think I agree with you. Virtually
all unix and linux variants have rsh/ssh and rexec, which do pretty much
exactly what I'm looking for without being unacceptable security risks.
It appears that it's possible to do what I'm describing using WMI on
windows as well - the trick is figuring out exactly how to do it, and
whether it can be done in perl.

I think the distinction that has to be made is whether the remote
invocation (or remote copying, etc.) uses authentication and
authorization or some sort. Without it, certainly it would be a security
hole, but with appropriate authentication controls, I'd argue it's
actually a necessary management tool for systems in any large
enterprise, which is why I'm baffled that Microsoft has never come out
with any nice, simple rsh/ssh/rdist type tools for windows. I have a
third part app which has most of the functionality of rdist, but it sure
would be nice if it was a standard part of windows.

Anyway, the original question is still pending - any chance someone can
point me at a module, script or code snippet that will let me launch a
remote process as described in the original email?

Thanks again,
Barry



************************************************************************
****
*******
This message contains confidential information and is intended only for
the individual named. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and
delete this e-mail from your system. E-mail transmission cannot be
guaranteed to be secured or error-free as information could be
intercepted, corrupted, lost, destroyed, received late or incomplete, or
could contain viruses. The sender therefore does not accept liability
for any error or omission in the contents of this message, which arises
as a result of e-mail transmission. If verification is required, please
request a hard-copy version from the sender.
************************************************************************
****
*******

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to