Try putting in some error checking:
use Win32::TieRegistry(Delimiter => "/");
$software = $Registry->{'HKEY_LOCAL_MACHINE/Software'} || die "Could not
open HKLM/Software!\n";
$value = $software->{'Microsoft/Windows/CurrentVersion/Run/NGClient'} || die
"Couldn't read value!\n";
print $value;
-----Original Message-----
From: Ali Mesdaq [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 27, 2002 12:44 PM
To: [EMAIL PROTECTED]
Subject: RE: Newbe: Problems accessing win2kpro registry
This isnt working for me. I am just trying to print out a value from the
registry and its not working.
############
print
$Registry->{"LMachine/Software/Microsoft/Windows/CurrentVersion/Run/NGClient
"};
############
do I have to further specify what i want to print? maybe like the registry
value type?
-----Original Message-----
From: Ed Sprenger
To: Ali Mesdaq
Cc: '[EMAIL PROTECTED]'
Sent: 2/27/2002 11:33 AM
Subject: Re: Newbe: Problems accessing win2kpro registry
The following code works for me. I use it to read and write
ODBC Datasource names on remote machines.
This will set the server property on the DSN named $DSN_name
to $value on server $server:
###################
# BEGIN CODE SNIP
###################
use Win32::TieRegistry (Delimiter => "/", ArrayValues => 0);
# Set value
$Registry->{"//$servername/LMachine/Software/ODBC/ODBC.INI/$DSN_name/ser
ver"}
= $value;
# Print value
print
$Registry->{"//$servername/LMachine/Software/ODBC/ODBC.INI/$DSN_name/ser
ver"};
##################
# END CODE SNIP
##################
Set $server to a valid Win2000 machine that you have admin
permissions on, change the registry path to the key you want
to change, and specify your value.
Ali Mesdaq wrote:
>
> I have a situation like this myself. I want to query the registry the
> easiest way possible and then set the value of what I just queried. I
am
> trying to use tieregistry and other mods like registry but I cant seem
to
> get the syntax correct. Lets just say I wanted to get the computername
like
> the other examples how cant I get that value and then set it to
something
> else?
>
> -----Original Message-----
> From: Thomas R Wyant_III [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 27, 2002 5:49 AM
> To: '[EMAIL PROTECTED]'
> Subject: Re: Newbe: Problems accessing win2kpro registry
>
> "Wheldon,M" <[EMAIL PROTECTED]> wrote:
>
> > Being relativly new to Perl could someone please explain why the
> > following doesn't work on a win2k pro box the problem is that the
> > registry
> > key is not being opened
>
> <snip>
>
> P.S. Since this is Perl, "There's More Than One Way To Do It."
>
> If it's specifically system name you're going after, you can go
another
> way:
>
> use Sys::Hostname;
>
> my $cnam = hostname;
>
> Caveat: under some releases of Windows (both NT and !NT) it is
possible for
> the system name, from the point of view of Microsoft networking, to be
> different than the system name from the point of view of TCP/IP. If
this is
> so, I don't know which is returned by hostname. You'll just have to
try it
> and see.
>
> Tom Wyant
>
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--------------------------------------------------------------------------------
This email may contain confidential and privileged
material for the sole use of the intended recipient.
If you are not the intended recipient, please contact
the sender and delete all copies.
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs