At 06/28/2001 06:29 AM, Jeroen Bakker wrote:
>Hi,
>
>I'm currently writing a script that, among other things, should create an
>NT user account. Most if it seems to work just fine, but i'm experiencing
>problems trying to set the following flags (using Win32:OLE):
>
>UserCannotChangePassword
>PasswordNeverExpires
>
>Executing the script returns an error saying that the member wasn't found.
>Perhaps I got the names wrong (after a long search and lots of attempts
>this was what i came up with) or maybe it just isn't supported. I'm using
>Win32:OLE version 0.1501. Do i have the names wrong? If so, what are they
>(or, where can i find them)? Or am i doing something fundamentally wrong?
Personally, I use the Win32API::Net that is part of the AS package. The
two options you are trying to set are configured using the "flag"
field. See below for an example.
rotaiv.
use Win32API::Net qw(UF_PASSWD_CANT_CHANGE UF_DONT_EXPIRE_PASSWD UF_SCRIPT
USER_PRIV_USER);
%acct_info = (
'name' => 'TestUser',
'password' => 'testing',
'passwordAge' => 0,
'priv' => USER_PRIV_USER,
'homeDir' => '',
'comment' => 'Created by Perl',
'flags' => UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD | UF_SCRIPT,
'scriptPath' => ''
);
# If no server is specified, current server is assumed
# To create domain account, use name of PDC - e.g '\\pdc'
$server = '';
Win32API::Net::UserAdd($server, 1, \%acct_info, $error) || die "$error - $!";
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin