Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to modify the windows registry, in particular to change my DNS search list (under windows NT). I've seen some examples of tie::registry but can't figure it out. Can anyone help? so far I have something like this, but I don't get any output.
$key = 'HKEY_LOCAL_MACHINE\SYSTEM\Services\Tcpip\Parameters'; use Win32::TieRegistry; $paramater = $Registry->{$key}; print $parameter;

Replies are listed 'Best First'.
Re: modify searchlist in registry
by larryk (Friar) on Aug 07, 2002 at 12:52 UTC
    Apart from the typo, it's because you missed out CurrentControlSet... the full "path" should be HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters.

    P.S. The value is a hash so if you wanna look into it you'd be better with:

    #!perl use strict; use warnings; use Data::Dumper; use Win32::TieRegistry; my $key = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\ +Parameters'; my $parameter = $Registry->{$key}; print Dumper($parameter);
    Although that will give you _loads_ of info!
       larryk                                          
    perl -le "s,,reverse killer,e,y,rifle,lycra,,print"
    
      thanks, that works just fine, i can now retrieve the search list with;
      my $key = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\ +Parameters\SearchList'; my $search_list = $Registry->{$key};
      but how about changing the value?
        just assign value to $Regitry->{key};, and registry will be updated via internal "tie" magic.