S
Simon
Hi guys hope you can help.
I have the following script which connects to remote machines and returns
information about the values of certain registry keys.
All is good, but the way the script runs is that it does this....
Connects to first machine.......returns data
Then connects to next machine....returns data
Then the next
Then the next and so on.
What Id like to be able to do, because we have so many machines to process,
is to do the following...
Connect to, say 10 machines all at the same time, then return data back to
the one main console (where I executed the script in the first place),
instead of waiting for 1 machine to end, then move on to the next.
Any help greatly appreciated. Here is the script.
================================================================= Script
use Win32;
use Win32::Registry;
sub RunRegQuery {
$p = 'Software\Network Associates\TVD\VirusScan Enterprise\CurrentVersion';
Win32::RegOpenKeyEx(&HKEY_LOCAL_MACHINE,$p,&NULL,&
KEY_QUERY_VALUE|&KEY_SET_VALUE,$hkey);
Win32::RegQueryValueEx($hkey,"szVirDefVer",&NULL,$ type,$Definition);
Win32::RegQueryValueEx($hkey,"szProductVer",&NULL, $type,$Product);
Win32::RegQueryValueEx($hkey,"szEngineVer",&NULL,$ type,$Engine);
print "$SystemName\n";
print "$Definition\n";
print "$Product\n";
print "$Engine\n";
print " \n";
}
##########
## MAIN ##
##########
open (Store, "< llsystems.txt") or die "can't open systems.txt: $!";
foreach $line (<Store>)
{
chomp($line);
$SystemName = $line;
if ($SystemName =~ /^l/i) {
system ("net use \\\\$SystemName\\ipc\$ "password"
/user:$SystemName\\useraccount > NUL");
sleep 3;
RunRegQuery();
system ("net use \\\\$SystemName\\ipc\$ /delete /y > 2NUL > NUL"); # Delete
previous connection
}
else {
print "not a valid system\n";
}
}
close (Store);
exit;
=================================================================== End of
script
Output is as follows..
C:\>script.pl
Lcomputer1
5060
8.0.0.912
5100
Lcomputer2
5060
8.0.0.912
5100
Lcomputer3
5060
8.0.0.912
5100
etc etc
Any help greatly appreciated guys, thank you.
S
I have the following script which connects to remote machines and returns
information about the values of certain registry keys.
All is good, but the way the script runs is that it does this....
Connects to first machine.......returns data
Then connects to next machine....returns data
Then the next
Then the next and so on.
What Id like to be able to do, because we have so many machines to process,
is to do the following...
Connect to, say 10 machines all at the same time, then return data back to
the one main console (where I executed the script in the first place),
instead of waiting for 1 machine to end, then move on to the next.
Any help greatly appreciated. Here is the script.
================================================================= Script
use Win32;
use Win32::Registry;
sub RunRegQuery {
$p = 'Software\Network Associates\TVD\VirusScan Enterprise\CurrentVersion';
Win32::RegOpenKeyEx(&HKEY_LOCAL_MACHINE,$p,&NULL,&
KEY_QUERY_VALUE|&KEY_SET_VALUE,$hkey);
Win32::RegQueryValueEx($hkey,"szVirDefVer",&NULL,$ type,$Definition);
Win32::RegQueryValueEx($hkey,"szProductVer",&NULL, $type,$Product);
Win32::RegQueryValueEx($hkey,"szEngineVer",&NULL,$ type,$Engine);
print "$SystemName\n";
print "$Definition\n";
print "$Product\n";
print "$Engine\n";
print " \n";
}
##########
## MAIN ##
##########
open (Store, "< llsystems.txt") or die "can't open systems.txt: $!";
foreach $line (<Store>)
{
chomp($line);
$SystemName = $line;
if ($SystemName =~ /^l/i) {
system ("net use \\\\$SystemName\\ipc\$ "password"
/user:$SystemName\\useraccount > NUL");
sleep 3;
RunRegQuery();
system ("net use \\\\$SystemName\\ipc\$ /delete /y > 2NUL > NUL"); # Delete
previous connection
}
else {
print "not a valid system\n";
}
}
close (Store);
exit;
=================================================================== End of
script
Output is as follows..
C:\>script.pl
Lcomputer1
5060
8.0.0.912
5100
Lcomputer2
5060
8.0.0.912
5100
Lcomputer3
5060
8.0.0.912
5100
etc etc
Any help greatly appreciated guys, thank you.
S