blackadder has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to capture only the applications ‘DisplayName’ and the ‘InstallSource’ off a remote Win32 registry. However, I do not want any empty entries from the Registry – because I will be piping the results into Excel and I want to avoid any errors – Ultimately I would like to create an array of anonymous hashes contaning this information, but I am not able to do this for some reason, …I tried and tried! Can someone please help? Thanks.#! c:/perl/bin -slw use Win32::Registry; use vars qw/%data @source @target/; if ($HKEY_LOCAL_MACHINE->Connect($ARGV[0], my $root)) { print "\nSuccessfully connect to remote registry on $ARGV[0]\n"; if ($root->Open("Software\\Microsoft\\Windows\\CurrentVersion\\Unin +stall", my $Key)) { print "Obtaining software information....Please wait\n"; my @keys; $Key->GetKeys( \@keys ); for my $subkey ( @keys ) { $Key->Open( $subkey, my $x ) or die $^E; my %vals; my $rec; $x->GetValues(\%vals ); for my $item (keys %vals) { $rec->{app} = $vals{$item}[2] if ($item=~ /DisplayName/i); $rec->{path} = $vals{$item}[2] if ($item=~ /InstallSource/ +i); print "$rec->{app} : $rec->{path}\n"; #push (@source, $rec); } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: capturing entries from the Registry
by eric256 (Parson) on Jun 10, 2004 at 17:01 UTC | |
by blueAdept (Beadle) on Jun 10, 2004 at 17:39 UTC | |
by eric256 (Parson) on Jun 10, 2004 at 17:51 UTC | |
by blackadder (Hermit) on Jun 11, 2004 at 09:08 UTC |