Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

RE: setting remote registry values

by Ozymandias (Hermit)
on Sep 22, 2000 at 22:09 UTC ( #33669=note: print w/replies, xml ) Need Help??

in reply to setting remote registry values

This is really not something you want to use Perl for. I would create a registry file (.reg) of the keys you want to change; use regedit to do that.

You can then use regedit again to insert the registry values into other workstations, or there are a few other ways to do it as well. The best way would be to use System Policy Editor from the DC so that the changes are made as people log in. (See O'Reilly's System Policy Editor, or the Microsoft KnowledgeBase for more information on doing that; it's not too complicated). Another, similar method is to build a batch script file to import the .reg file as a logon script; that's also not too complicated.

The last method I would use would be Perl. This is one case where the Swiss Army Chainsaw is the wrong tool for the job.

- email Ozymandias

Replies are listed 'Best First'.
RE: RE: setting remote registry values
by why (Acolyte) on Sep 22, 2000 at 22:46 UTC

    Actually, Perl is often perfect for this. The Policy Editor is good for forcing changes that your users keep undoing (something I don't have a need for and hate when I see others do it). But I find lots of uses for remote registry changes. For example, using VNC (a free "PC Anywhere" tool), batch updates of passwords on dozens of servers would be a pain or unworkable using either of your suggestions.

    my $Reg; use Win32::TieRegistry( TiedRef => \$Reg, Delimiter => "/", ArrayValues => 1 ); for my $mach ( @ARGV ) { my $remReg= $Reg->{"//$mach/LMachine/"} or do { warn "Can't access ${mach}'s registry: $^E\n"; next; } my $linux= $remReg->{"Software/Slackware/Linux/CurrentVersion/ +"} or die "Can't read ${mach}'s SW/SW/Linux/: $^E\n"; $linux->{"Passwords//root"}= "guessme" or die "Can't modify ${mach}'s root password: $^E\n"; }

    (Note that the above code is just "silly" in that you can't install Linux as an application under Win32 and even if you did you probably wouldn't set the passwords as plain-text in the registry.)

    I actually have a script that lets you define a remote installation file describing what file to copy to the remote machine and what changes to make to the registry. You can use it to install software locally (it was used to automate installation of third-party software on machines we sold) or to install something on a whole list of remote machines in one step. Existing tools were not up to this task because the registry changes are not uniform and most "sysdiff"-like tools have no or very limited ability to make the changes context sensitive.

    For the original poster, it is usually much better to give us the example code that you tried and couldn't get to work along with complete details about how it doesn't work. Asking vague questions and asking for examples usually doesn't get you as many answers nor nearly as good of answers.

      You beat me to it. I was just about to post my suggestion to use Win32::TieRegistry, which, by the way, was written by a Perl Monk.
Re^2: setting remote registry values
by Anonymous Monk on Sep 13, 2004 at 10:05 UTC
    I am getting "Access Denied" message when tried the code on remote machine. Can any one help me in accessing the remote registry's key names to search for the patch numbers?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://33669]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2020-04-07 18:02 GMT
Find Nodes?
    Voting Booth?
    The most amusing oxymoron is:

    Results (43 votes). Check out past polls.