Hello John,

Here is a example from Roth's Win32 Perl Programming Standard Extentions 2nd ed.:

use Win32::Console;
my $StdIn = new Win32::Console( STD_INPUT_HANDLE );
my $Password = "";
$StdIn->Mode( ENABLE_PROCESSED_INPUT );
print "Enter password: ";
while( my $Data = "$StdIn-">InputChar( 1 ) ) {
    if( "\r" eq $Data ) {   # check's if Enter key is hit
       last;
    }
    elsif( "\ch" eq $Data ) {  # check's if Backspace key is hit
       if( "" ne chop( $Password ) ) {
          print "\ch \ch";
       }
       next;
    }
    $Password .= $Data;
    print "*";
}
print "\nYour password is: '$Password'\n";
 

Hope it will solve your problem.
Paul.
 

"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