Sorry.  You might want to add the line:

    no warnings qw(uninitialized);

to that code to avoid all of those warnings about DisplayName not being
defined.

Another way would be to add an if block around the print:

if(defined($Registry->{"$key/$subkey/DisplayName"}{
   print "$subkey => $name\n";
}


-----Original Message-----
From: Timothy Johnson 
Sent: Wednesday, June 07, 2006 8:56 AM
To: 'Richard Burns-Allan'; perl-win32-admin@listserv.ActiveState.com
Subject: RE: Tieregistry problems with Add/Remove Programs list


I'm not seeing the problem you're describing.  Here's the code I used
(one small change to make sure we're getting the "GUID keys".

####################
#!/usr/bin/perl -w
use strict;
use warnings;

use Win32::TieRegistry(Delimiter => '/');

my $key =
'LMachine/Software/Microsoft/Windows/CurrentVersion/Uninstall';

foreach my $subkey ( keys(%{$Registry->{$key}}) ) {
    # beware: $subkey comes with a trailing slash
    my $name = $Registry->{"$key/$subkey/DisplayName"};
    print "$subkey => $name\n";
}

#####################

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Richard Burns-Allan
Sent: Wednesday, June 07, 2006 8:03 AM
To: perl-win32-admin@listserv.ActiveState.com
Subject: Tieregistry problems with Add/Remove Programs list

Sorry if this has been asked before - I've looked and couldn't find it.
I'm fairly new to this and having some problems getting Tieregistry to
do what I want it to.
I'm using the following (pinched from elsewhere on the net) to get the
display names of items in the Add/Remove Programs list which is
HKLM/Software/Microsoft/Windows/CurrentVersion/Uninstall/
It works to a certain extent - but misses out all the subkeys which have
the software GUID instead of a string as the subkey name.
For example on my machine the subkey
{04AE4390-AC57-44A1-9165-FAF5C6BFB14E} does have a value name of
DisplayName, which has the value Autodesk Deployment Wizard, but this
doesn't print out on the list.
I've tried quoting the subkey, escaping the curlys, removing them  -
allsorts really, but can't get it to work. Please help.

#!/usr/bin/perl -w
use strict;
use warnings;

use Win32::TieRegistry(Delimiter => '/');

my $key =
'LMachine/Software/Microsoft/Windows/CurrentVersion/Uninstall';

foreach my $subkey ( keys(%{$Registry->{$key}}) ) {
# beware: $subkey comes with a trailing slash
my $name = $Registry->{"$key/$subkey/DisplayName"} || next;
print "$name\n";
}

Thanks,
--Richard Burns-Allan

DipComp DipIT BSc(Hons) MBCS
MCSA(2000 & 2003) MCSE(NT4, 2000, 2003) Security+

IT Systems Engineer
Ross-shire Engineering Limited
Tel: 01463 870049


_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to