----- Original Message -----
From: "Mark Halley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 16, 2001 11:11 AM
Subject: Problem with unload using TIE::REGISTRY
Hi Everyone!
> I'm trying to write a perl script that will load and unload
NTUSER.DAT on remote NT servers. From examples I've found, I
hacked together a test script, listed below, that works except
for the unload. When I run the script, I get the following
output:
>
> > Connected OK
> > Key Loaded OK
> > Value = |smsrun32.exe|
> > Error: The handle is invalid
>
> The weird part is, when I check the remote registry, using
REGEDT32, the key does get unloaded.
> I'm using Perl 5.6, build 623. Also, I am running this under
the Administrator account.
>
> Does anyone have any ideas on what I'm doing wrong? Any
suggestions would be greatly appreciated!
>
> Thanks again!
> Mark Halley
> [EMAIL PROTECTED]
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> use Win32::TieRegistry (Delimiter=>"/",AllowLoad => 1,AllowSave
=> 1,qw(KEY_READ KEY_WRITE KEY_ALL_ACCESS));
> my $Machine = "TESTSRV";
> my $RRoot;
> my $RKey;
> my $Value;
> my $KeyName = "Mark";
>
> if ($RRoot =
$Registry->Connect("$Machine","HKEY_USERS",{Access=>KEY_ALL_ACCES
S}))
> {
> print "Connected OK\n";
> } else {
> die "Unable to connect to $Machine\n";
> }
>
> if ($RKey =
$RRoot->Load("c:\\winnt\\profiles\\username\\ntuser.dat",$KeyName
,{Access=>KEY_ALL_ACCESS}))
> {
> print "Key loaded ok\n";
> } else {
> die "Unable to load key\n";
> }
>
> if ($Value = $RKey->{"Software/Microsoft/Windows
NT/CurrentVersion/Windows//Load"})
> {
> print "Value = |$Value|\n";
> } else {
> print "Unable to get info\n";
> }
>
> # $RKey->UnLoad || print "Unable to unload key from
registry\n";
>
> if (Win32API::Registry::RegUnLoadKey($RRoot, $KeyName))
> {
> print "Unloaded ok\n";
> } else {
> print "Error: " . Win32API::Registry::regLastError() .
"\n";
> }
>
Try undefining the variables, i.e.
undef $RKey;
undef $RRoot;
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin