Hi,
 
I am trying to change the path in Windows 2000 (terminal server session)
on a per user basis and set a specific variable.
I have tried to use Win32::AdminMisc, but this only changes the path and
the variable during the time the script runs.
 
Is there a way to set the path globally (at logon) so the user can use
during his/her session?
 
Please keep in mind that I am no "real" programmer, just a sysadmin
trying to automate some tasks with perl. 
 
Here is the script I wrote:
 
------------------------------------------------------------------------
---
 
#!perl
 
use win32::adminmisc;
use win32;
use strict;
my $UserLoginName = $ENV{"USERNAME"};
my $Fixed_Path = $ENV{"PATH"};
my $VCSID = uc(substr($UserLoginName,0,3));
Win32::AdminMisc::SetEnvVar("VCSID",$VCSID);
my $UserPath;
 
for ($UserLoginName) 
  {
  if ($UserLoginName eq "domainuser1")     
     {
     $UserPath = $Fixed_Path.";d:\\User1"
     }
  elsif ($UserLoginName eq "domainuser2")   
     {
     $UserPath = $Fixed_Path.";d:\\User2"
     }     
  elsif ($UserLoginName eq "domainuser3")  
     {
     $UserPath = $Fixed_Path.";d:\\User3"
     }     
  elsif ($UserLoginName eq "domainuser4")   
     {
     $UserPath = $Fixed_Path.";d:\\User4"
     }     
  elsif ($UserLoginName eq "domainuser5")  
     {
     $UserPath = $Fixed_Path.";d:\\User5"
     }     
  elsif ($UserLoginName eq "domainuser6")   
     {
     $UserPath = $Fixed_Path.";d:\\User6"
     }
  };
Win32::AdminMisc::SetEnvVar("PATH",$UserPath);

 
------------------------------------------------------------------------
---

Thanx,

Bob


_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to