Hi Folks,

I'm currently using Win32::KillProcess to deploy patches to remote machines,
and would like the script to use the logon credentials of the user running
the script rather than having to prompt the user for a password. Does anyone
know how to collect username and password for the current logged-on user?
Here's a shortened version (tested) of the script: 

#####BEGIN######
use strict;
use warnings;
use Win32::KillProcess;
use Term::ReadKey;
use Socket;

my $username = "administrator";
print "please enter $username password: ";
ReadMode 'noecho';
my $password = ReadLine 0;
chomp $password;
print "\n";

my $command = "c:\\winnt\\WindowsNT4Workstation-KB835732-x86-ENU.EXE -q -z";
my $server = "PCname";

&runRemoteCommand($command, $server);

sub runRemoteCommand() {
        my ($command, $computer) = @_;
        my ($c, $pid);
        eval {$c = Win32::KillProcess::connectServer($computer, $username,
$password);
                print "$computer, $c,";
                $pid = Win32::KillProcess::startProcess( $c, $command);
                print "$pid\n";
        };
        print "$computer, [EMAIL PROTECTED]" if $@;
}
######END#######

Many Thanks In Advance

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

Reply via email to