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

I've saved to file registry node.
use Win32::TieRegistry; $REMOTE= $Registry->Connect( '127.0.0.1','LMachine',{Delimiter=>"\\"} +) or die; my $key_to_delete="SYSTEM\\RAdmin\\"; $REMOTE->{$key_to_delete}->AllowSave( 1 ); $REMOTE->{$key_to_delete}->RegSaveKey( "C:/test.reg", [] ) or die;
The node is saved into c:\test.reg. Then I deleted this node from registry and trying to load it.
my $load_to_key=$REMOTE->{"SYSTEM\\"}; $load_to_key->AllowLoad( 1 ); $load_to_key->RegLoadKey( "RAdmin", "c:/test.reg" ) or die $^E;
Having dead "Access denied" :(
What is wrong?

Replies are listed 'Best First'.
Re: Win32::TieRegistry Loading saved key. (Load vs Restore)
by tye (Sage) on Jan 20, 2006 at 17:58 UTC

    Quoting Win32API::Registry's documentation:

    $hKey is the handle to a Registry key that can have hives loaded to it. This must be HKEY_LOCAL_MACHINE, HKEY_USERS, or a remote version of one of these from a call to RegConnectRegistry().

    And SYSTEM isn't LMachine nor Users.

    You probably want RegRestoreKey:

    Reads in a hive file and copies its contents over an existing Registry tree.

    - tye        

      May be RegRestoreKey...
      I need to be able to backup/restore remote registry data.