the script I used to add the printer (for all its damn worth) was this;use Win32::TieRegistry; $printerKey= $Registry->{"HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\P +rint\\Printers\\"} or die "Can't read Printers key: $^E\n"; @printers= keys( %{$printerKey} ); foreach $printer (@printers) { print $printerKey->{$printer."\\Name"}."\n"; if ($printerKey->{$printer."\\Name"}=~ /\\\\printer_server\\/) { delete $printerKey->{$printer."\\Name"}; } }
Your help is highly appreciated (a code example triple so)#!c:/perl/bin/perl.exe -w use strict; use vars qw/%data/; $data{printer_server}= "\\\\print_server\\"; $data{PSEXEC}="\\\\Remote_host\\C\$\\Tools\\PSTools\\PSEXEC\\psexec.ex +e"; $data{usr}= "XXX\\Blackadder_ad"; $data{pw}= "Supernatural2005"; $data{command}= " cmd.exe /c start"; open (LST, "$ARGV[0]") || die "File Name => $ARGV[0] $!\n"; chomp (@{$data{host_names}} = <LST>); for (@{$data{host_names}}) { print "$_ : "; &install_printers($_); } sub install_printers { my ($target) = @_; my $const = 'snp'; my $switches = ' -i -d -u '; print "$target : "; if ($target =~ /^SN01/) { print " First Flr Printers, "; for (1..9) { $_ = '10'.$_; `$data{PSEXEC} \\\\$target -i -d -u $data{usr} -p $data{pw} c +md /c start $data{printer_server}$const$_`; print "$const$_,"; } } if ($target =~ /^SN02/) { print " Second Flr Printers, "; for (0..7) { $_ = '20'.$_; `$data{PSEXEC} \\\\$target -i -d -u $data{usr} -p $data{pw} c +md /c start $data{printer_server}$const$_`; print "$const$_, "; } } print "\n"; } print "\n____________End of List____________\n";
In reply to Removing printers from remote WinXP PC by blackadder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |