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);
In reply to Reading Subkeys with Win32::TieRegistry by Al_Gee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |