Wesley,

Here's a small example of how I use Perl for this purpose:

========================================================================================

use Win32::NetAdmin qw(GetServers);
use Win32::TieRegistry(Delimiter=>"/");

sub set_env_vars();

exit set_env_vars();

sub set_env_vars()  {
     my $envKey="LMachine/System/CurrentControlSet/Control/Session 
Manager/Environment";
     my @wkstas;
     my ($srv, $rReg);
     GetServers("", "DOMAIN", 3, \@wkstas)
          or die "GetServers() failed with $^E";
     @wkstas = grep(/^FA/,@wkstas);
     foreach $wksta (@wkstas) {
          if ($rReg = $Registry->Connect($wksta,$envKey)) {
               $rReg->{"/TestVar"} = "How about this?";
               print "\n$wksta has now TestVar as " . $rReg->{"/TestVar"};
               $rc = delete $rReg->{"/TestVar"}
          } else {
               print "$wksta could not be contacted! $^E\n"
          }
     }
     exit 0;
}

========================================================================================




"North, Wesley J" <[EMAIL PROTECTED]>@listserv.ActiveState.com on
10/05/2001 18:32:47

Sent by:  [EMAIL PROTECTED]


To:   "'[EMAIL PROTECTED]'"
      <[EMAIL PROTECTED]>
cc:

Subject:  System and User environment Variables


Group,

     Is there a way, via Perl, to permanently set some system and user
environment variables on NT workstations? We have to add 5 different
variables to over 40 different machines and I was wondering if this could
be
automated via a Perl script. Thoughts? Suggestions? All are welcome.
Thanks.


-Wes
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl



_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to