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/server"}
= $value;

# Print value
print
$Registry->{"//$servername/LMachine/Software/ODBC/ODBC.INI/$DSN_name/server"};

##################
# 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

Reply via email to