J
jairagoo
Hail All,
I am trying to write a script that looks at all my windows computers
within a subnet and return the "Computer Name and Logon on users". My
attempt below returns the computername appropriately but it doesn't
return the "Logon User Name". I physically look at the registry and see
the user's name there but this script does not return that value.
Someone please help ;-)
######OUTPUT########
10.2.4.29=> => COMPUTER5
10.2.4.30=> => COMPUTER0
10.2.4.31=> => COMPUTER6
10.2.4.32=> => COMPUTER9
10.2.4.33=> => COMPUTER4
10.2.4.35=> => COMPUTER2
#####################
#!c:\perl\bin\perl
use Win32::TieRegistry;
my @subnet =qw(4);
foreach $subnet (@subnet) {
for (my $i=1;$i <100;$i++){
$computer = qq(10.2.$subnet.$i);
$pinger=`ping -n 1 $computer`;
if($pinger=~ /Reply from/) {
$username=$Registry->{"\\\\$computer\\CUser\\Software\\Microsoft\\"
."Windows\\CurrentVersion\\Explorer\\\\Logon User Name"};
$computerName=$Registry->{"\\\\$computer\\LMachine\\SYSTEM\\"
."CurrentControlSet\\Control\\ComputerName\\ComputerName\\\\"
."ComputerName"};
print "$computer=> $username=> $computerName\n";
}
}
}
thank you.
Darth
I am trying to write a script that looks at all my windows computers
within a subnet and return the "Computer Name and Logon on users". My
attempt below returns the computername appropriately but it doesn't
return the "Logon User Name". I physically look at the registry and see
the user's name there but this script does not return that value.
Someone please help ;-)
######OUTPUT########
10.2.4.29=> => COMPUTER5
10.2.4.30=> => COMPUTER0
10.2.4.31=> => COMPUTER6
10.2.4.32=> => COMPUTER9
10.2.4.33=> => COMPUTER4
10.2.4.35=> => COMPUTER2
#####################
#!c:\perl\bin\perl
use Win32::TieRegistry;
my @subnet =qw(4);
foreach $subnet (@subnet) {
for (my $i=1;$i <100;$i++){
$computer = qq(10.2.$subnet.$i);
$pinger=`ping -n 1 $computer`;
if($pinger=~ /Reply from/) {
$username=$Registry->{"\\\\$computer\\CUser\\Software\\Microsoft\\"
."Windows\\CurrentVersion\\Explorer\\\\Logon User Name"};
$computerName=$Registry->{"\\\\$computer\\LMachine\\SYSTEM\\"
."CurrentControlSet\\Control\\ComputerName\\ComputerName\\\\"
."ComputerName"};
print "$computer=> $username=> $computerName\n";
}
}
}
thank you.
Darth