
Running NT Login Script over Slow RAS
Thanks for your reply. Sorry for my duplicate post, I didn't think my
original post made it. Anyway, here is my script. It runs a program called
vpdget (which is 2KB) and saves the output to the client hard drive
(asset.txt is usually about 30 bytes). It then collects some asset
information about the client's PC and
saves it to the server. When I run the script on the LAN it executes in 2-3
seconds. I tested it over a 28.8 and a 46Kb RAS connection and it took
about 5 minutes both times. My first print statement does not appear (when
using RAS) until almost the end of the 5 minutes.
I am also working out another bug: the Users LoginName is not always
captured. Sometimes it comes up empty, everything else has been working
well.
Any insight to either problem is greatly appreciated.
Regards,
Scott McCosh
use strict;
use mldbm;
my $tmp;
my $ExecutionPath = "\\\\server\\perl\$\\script\\";
print "Please wait while I gather your asset information...\n";
system ($ExecutionPath."vpdget.exe > c:\\asset.txt");
open (VPDGET, "c:\\asset.txt") || die $!;
close(VPDGET);
if ($bios_size < 2){
Quote:
}
use Win32;
my $name = Win32::LoginName;
$name =~ tr/a-z/A-Z/;
my $machine = Win32::NodeName;
$machine =~ tr/a-z/A-Z/;
use win32::Registry;
my $reg = "SOFTWARE\\Intel\\LANDesk\\Inventory\\Custom Fields";
my $SquareOne;
$main::HKEY_LOCAL_MACHINE->Open($reg, $SquareOne);
#### || warn "Could not open Registry, LanDesk might not be installed: $!";
my %values;
$SquareOne->GetValues(\%values);
my $key;
my $reg_size = keys(%values);
my $pc_name_key;
if ($bios_size > 1){
$pc_name_key = $machine . $bios[1];
Quote:
}else{
if ($reg_size > 1){
$key = $values{"serial number"};
$pc_name_key = $machine . $$key[2];
}else{
$pc_name_key = $machine;
}
Quote:
}
my %USERS;
my %COMPUTERS;
tie %USERS, 'MLDBM', $ExecutionPath."users", 0666, 0640 or die $!;
tie %COMPUTERS, 'MLDBM', $ExecutionPath."computers", 0666, 0640 or die $!;
use Time::localtime;
my $time = ctime();
$tmp = $USERS{$name};
if($USERS{$name}{$pc_name_key}){
#### $tmp->{$pc_name_key}[0] = $machine;
$tmp->{$pc_name_key}[1]++;
$tmp->{$pc_name_key}[2] = $time;
Quote:
}else{
$tmp->{$pc_name_key} = [($machine,1,$time)];
Quote:
}
$USERS{$name} = $tmp;
####if($COMPUTERS{$pc_name_key}){
####}else{
$tmp = $COMPUTERS{$pc_name_key};
$tmp->{"Computer Name"} = $machine;
$tmp->{"Bios Junk"} = $bios[0];
$tmp->{"Bios Serial Number"} = $bios[1];
$tmp->{"Bios Model Type"} = $bios[2];
if ($reg_size < 2){
$tmp->{"Square One"} = "No";
}else{
my $k;
my $key;
$tmp->{"Square One"} = "Yes";
foreach $k (keys %values){
if ($k ne ""){
$key = $values{$k};
$tmp->{$k} = $$key[2];
}
}
}
$COMPUTERS{$pc_name_key} = $tmp;
####}
print "Finished Successfully! You may now close this DOS window.\n";