Hi - very sorry and many thanks.
here what I have now;
use strict;
use Win32::Registry;
use vars qw/%data @source @target @missing/;
if ($HKEY_LOCAL_MACHINE->Connect($ARGV[0], my $root))
{
print "\nSuccessfully connect to remote registry on $ARGV[0]\n";
if ($root->Open("System\\CurrentControlSet\\Control\\Print", my $Ke
+y))
{
print "Obtaining printer information....Please wait\n";
my @keys;
$Key->GetKeys( \@keys );
print "\nListing printers found on source machine\n";
print "\n-------------------------------------------------------
+------\n";
for my $subkey ( @keys )
{
print "\n\nSubKey : $subkey\n";
$Key->Open( $subkey, my $x ) or die $^E;
my %vals;
my @vals;
$x->GetKeys( \@vals );
for my $item (@vals)
{
next if ($item !~ /^,,My_print_server01/);
print "Items within : $item\n";
regDelTree($item, "HKEY_LOCAL_MACHINE\\System\\CurrentCont
+rolSet\\Control\\Print\\Printers\\")
}
}
$Key->Close;
}
}
else
{
die"FATAL ERROR : NO SOURCE MACHINE $ARGV[0], $^E\n";
}
sub regDelTree {
my $rootKey= shift @_; # Reg key to del subtree from
my $keyName= shift @_; # Name of key to delete
{
my $key= $rootKey->{$keyName};
if( ! $key ) {
warn "Can't open $keyName in ",
$rootKey->Path(), ": $^E\n";
return;
}
for( $key->SubKeyNames() ) {
regDelTree( $key, "$_\\" );
}
}
delete $rootKey->{$keyName}
or warn "Can't delete $keyName from ",
$rootKey->Path(), ": $^E\n";
}
And I get this error
C:\Perl>comp_apps1.pl Remote_WorkStation01
Successfully connect to remote registry on Remote_WorkStation01
Obtaining printer information....Please wait
Listing printers found on source machine
-------------------------------------------------------------
SubKey : Environments
SubKey : Forms
SubKey : Monitors
SubKey : PendingUpgrades
SubKey : Providers
SubKey : Printers
Items within : ,,My_print_server01,Printer_device200
Can't use string (",,My_print_server01,Printer_device200") as a HASH r
+ef while "strict refs" in use at C:\Perl\comp_apps1.pl line 40.
C:\Perl>
Any Advise Please?,....Many thanks in advance.
Regards
|