I have had trouble with the connect method in the registry module.  I later learned 
that it doesn't come with the connect method and it needs to be added manually to the 
end of registry.pm.  If connecting to the registry of the remote machine is your 
problem I can send you the connect method to add to registry.pm, I got it off of 
www.roth.net.

-----Original Message-----
From: Ryan, David [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 9:22 AM
To: '[EMAIL PROTECTED]'
Subject: Trying to Connect and Modify Remote Registry on NT 4


> I am currently testing code to modify a remote NT Workstation's Registry
> value (AutoShareWks).  At this point, I just have Perl trying to print out
> the value, but am getting the following error message.  If I can get this
> to work, I will then set the value to 1 to turn on "Create hidden drive
> shares (workstation)" on 73 workstations which were deployed incorrectly.
> Any help interpreting it would be appreciated.  The code is a combination
> of examples 3.16 and 3.21 from Roth's Std Extensions book.
> 
Error Message:

> Variable "$HKEY_LOCAL_MACHINE" is not imported at line XX
> (Did you mean &HKEY_LOCAL_MACHINE instead?)
> Global symbol "$HKEY_LOCAL_MACHINE" requires explicit package name at line
> XX  
> 
> ####################################################################
> 
use Win32::Registry;
> $Machine = "\\\\NT_WORKSTATION1";
> $KeyName   =
> "System\\CurrentControlSet\\Services\\LanmanServer\\Parameters";
> $ValueName = "AutoShareWks";
> 
> if ($HKEY_LOCAL_MACHINE->Connect($Machine, $Root)) { # This is line XX
>     if ($Root->Open($KeyName, $Key)) {
>         if ($Key->QueryValueEx($ValueName, $DataType, $Data)) {
>             if ( REG_DWORD == $DataType ) {
>                 print "Value of AutoShareWks = $Data\n";
>     ##          $Data = 1;
>     ##          $Key->SetValueEx($ValueName, 0, $DataType, $Data);
>             }
>         }
>     }
> }
> 
> 
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to