#
use Win32::Registry;
use Win32::NetAdmin;
use Win32::OLE qw{in};
my $now = scalar localtime();
my $Domain = shift @ARGV || Win32::DomainName();
my @List;
my @filelist;
my $server;
$separator = "="x65;
open (OUTPUT, ">c:\\TEMP\\machinelist.tmp") || die ("CAN'T OPEN machinelist.tmp");
print (OUTPUT2 "MachineName, Name, Type, Value\n");
#### Discover machines connected to the network
if (Win32::NetAdmin::GetServers('', $Domain, SV_TYPE_ALL, [EMAIL PROTECTED]))
{
#DONOTUNCOMMENT#TESTVAR## print (OUTPUT "The machines in the $Domain domain are:\n");
map
{
####Will print the machines that are connected to the domain
#DONOTUNCOMMENT#chop $_;
print (OUTPUT "$_ \n");
} @List;
}
else
{
print (OUTPUT Win32::FormatMessage(Win32::Lanman::GetLastError()));
}
close OUTPUT;
open (COMPLIST, "c:\\TEMP\\machinelist.tmp") || die ("CAN'T OPEN machinelist.tmp\n");
# DONOT UNCOMMENT FOR TESTING ONLY open (COMPLIST, "c:\\TEMP\\test.tmp") || die ("CAN'T OPEN test.tmp\n");
# declare vars
@filelist=<COMPLIST>;
# $part = " ";
## MAIN ##
foreach $listitem (@filelist)
{
chomp $listitem;
#Set the registry data types up for display
@registryDataTypes = (
"REG_NONE",
"REG_SZ",
"REG_EXPAND_SZ",
"REG_BINARY",
"REG_DWORD",
"REG_DWORD_BIG_ENDIAN",
"REG_LINK",
"REG_MULTI_SZ");
$Check1 = $HKEY_LOCAL_MACHINE->Connect($listitem, $Root);
{
print Listitem => $listitem;
print (OUTPUT2 "$listitem,");
if ($Root->Open($key, $keyList))
{
#print Root => $Root;
$keyList->GetValues(\%keyValues);
{
print "\nThe index is the same as the name: $valueIndex\n";
print "$separator\n";
#The name of the value being retrieved is in the first
# cell of the array reference
print "\tName => $keyValues{$valueIndex}->[0]\n";
print (OUTPUT2 "$keyValues{$valueIndex}->[0],");
#The data type of the value is in the second cell (cell 1)
#but the data type is only a number. So that number is
#used as an index in the data type names array created
#at the beginning of this program.
print "\tData Type => $registryDataTypes[$keyValues{$valueIndex}->[1]]\n";
print (OUTPUT2 "$registryDataTypes[$keyValues{$valueIndex}->[1]],");
#The actual value of the key is in cell 2
print "\tValue => $keyValues{$valueIndex}->[2]\n";
print (OUTPUT2 "$keyValues{$valueIndex}->[2]\n");
}
$keyList->Close();
}
else
{
print "Can not Open $Root\n";
print (OUTPUT2 "*** $listitem, Can not Open $Root\n");
}
$Root->Close();
}
else
{
print "Can not Connect to $listitem\n";
print (OUTPUT2 "Can not Connect to $listitem\n");
}
_____________________________________________________
This email is confidential and intended solely for the use of
the individual or organization to whom it is addressed. Any
opinions or advice presented are solely those of the author
and do not necessarily represent those of the Millward Brown
Group of Companies. DO NOT copy, modify, distribute or
take any action in reliance on this email if you are not the
intended recipient. If you have received this email in error
please notify the sender and delete this email from your system.
Although this email has been checked for viruses and other
defects, no responsibility can be accepted for any loss or
damage arising from its receipt or use.
______________________________________________________
