use Term::ReadKey;
#
#       Get password
#
print "\nPassword : ";
ReadMode('noecho');
my $password = ReadLine(0);
print "\n\n";
chomp $password;
 

"Monroe, John M" wrote:

Hello all thanks for the help in advance.

I am writing a perl script to reinstall sms for bunch of domain admins
remotely.
I want to have them use their own username and password but do not
want the password to display on the screen as they type it in.
I am not sure how to accomplish this.

Here is what I have so far.

#!/bin/perl
#
****************************************************************************
*******
# * this script basically pushes plain-vanilla SMS clients to workstations
*
# * several setting will need to be checked each time this run
*
# * If you leave out the user name and password, it will fail
*
#
*
#
****************************************************************************
*******
# Version History
# 1.1  added multiple sites to the script
# 1.2  added prompt for username and password to remove dependency on single
account

$command_site1="\\\\serversite1\\sasi20\\admintools\\smsreinst.cmd";
$command_site2="\\\\serversite2\\sasi20\\admintools\\smsreinst.cmd";

print "Enter Domain and username. Usage: domain\username: ";
$username=<STDIN>;

print "Enter password: ";
$passwd=<STDIN>;

until ($site =~ /^site1$/ || $site =~ /^site1$/) {
  print "Please Type in Site.  Choices are: (site1|site2) ";
  $site=<STDIN>;
}

open(FH, "systems.txt") || die "Can't open systems.txt: $!\n";

if ($site =~ /site1/){
        while (<FH>) {
                $i = $_;
                system("psexec \\\\$i -u $username -p $passwd -c -f
$command_site1");
                }
                close(FH);
        }
        else{
                open(FH, "systems.txt") || die "Can't open systems.txt:
$!\n";
                while (<FH>) {
                        $i = $_;
                        system("psexec \\\\$i -u $username -p $passwd -c -f
$command_site2");
                        }
                close(FH);
                }
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to