> -----Original Message-----
> Hi all-

Hi Allen!

> I am new to the OLE module and relatively fresh to ADSI.  I 
> am in an odd situation with a product called Aelita owning my 
> world; bottom line is I can only make changes with ADSI not 
> api calls.  I am trying to write a script that will change a 
> user's script path.  I have found a few samples but they deal 
> with new user creation.  Any ideas?

I haven't had to create a user through ADSI, but I just went through
remapping everyone's home drive.  This script may get you started on
updating the user's "script path".  I have tweaked this script from what I
really ran and did not test again... YMMV.

use strict;
use warnings;
use Win32;
use Win32::OLE qw(in);

(my $RootDSE=Win32::OLE->GetObject('LDAP://rootDSE')) || die;
my $OUPath =
'OU=Group,OU=User,OU=Accounts,'.$RootDSE->Get('defaultNamingContext');
(my $UserList=Win32::OLE->GetObject("LDAP://$OUPath";)) || die;
for (in($UserList)) {
    print "$_->{cn}\n";
    my $User=Win32::OLE->GetObject("LDAP://CN=$_->{cn},$OUPath");
    if (defined $User->{HomeDirectory}) {
        my $Dir = '\\\\server\\'.$_->{cn};
        print "\t$User->{HomeDirectory} => $Dir\n";
        $User->{HomeDirectory}=$Dir;
        $User->SetInfo();
    }
}

Chris


LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be 
privileged. It is intended for the addressee(s) only. Access to this E-mail by 
anyone else is unauthorized. If you are not an addressee, any disclosure or 
copying of the contents of this E-mail or any action taken (or not taken) in 
reliance on it is unauthorized and may be unlawful. If you are not an 
addressee, please inform the sender immediately.
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to