Al_Gee has asked for the wisdom of the Perl Monks concerning the following question:
My production platform will be some Windows 2000 and 2003 servers. I am developing on a workstation running Windows XP Pro SP3 using Activstate perl 5.10.0.
I want to read the registry to get the names of the event logs (we have more than the standard three, and it varies amongst the different servers). There is a key at LMachine/System/CurrentControlSet/Services/EventLog that has beneath it as subkeys all of the event logs for the machine.
The code below will print out the subkeys for other keys in the registry including Services immediately above EventLog and any of the subkeys below EventLog. For EventLog, though, it opens the key, but it only prints the values.
Am I doing something wrong? Is there another way to get a list of the event logs?
Thanks--
Al
-----Included code
-----End included codeuse Win32::TieRegistry Delimiter => '/'; # # Here is the 'path' to the key in the registry. Here it is # set to look at the EventLog key. # my $name = join '/', qw/ LMachine System CurrentControlSet Services EventLog /; my $key = $Registry->{$name} or die "$0: can't open $name: $^E\n"; my(@subs,@vals); for (keys %$key) { print "$_\n"; if (m<^/(.*)$>s) { push @vals, $1; } elsif (m<^(.*)/$>s) { push @subs, $1; } } # # Run against other registry keys this prints out subkeys # and values. For EventLog, it only prints out values. # print "Subkeys of $name:\n", map( "$_\n", @subs), "Values of $name:\n", map( "$_=$key->{$_}\n", @vals);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading Subkeys with Win32::TieRegistry
by imrags (Monk) on Jan 23, 2009 at 07:40 UTC | |
by Al_Gee (Initiate) on Jan 26, 2009 at 14:33 UTC | |
|
Re: Reading Subkeys with Win32::TieRegistry
by dHarry (Abbot) on Jan 23, 2009 at 08:25 UTC | |
by Al_Gee (Initiate) on Jan 26, 2009 at 14:21 UTC | |
|
Re: Reading Subkeys with Win32::TieRegistry (debug)
by tye (Sage) on Jan 31, 2009 at 08:08 UTC | |
by Al_Gee (Initiate) on Feb 02, 2009 at 15:15 UTC |