Try

$shadow->{userAccountControl} = CODE;

instead.


Bryan J. Casto
Systems Programmer, Senior
Computing Services, Systems Group
Marshall University
One John Marshall Drive
Huntington, WV  25755-5320
Office: 1 (304) 696-2591
Fax: 1 (304) 696-3601
Email: [EMAIL PROTECTED] 
 

-----Original Message-----
From: Chris Perry [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 04, 2003 12:23 PM
To: [EMAIL PROTECTED]

I am getting the following error when I run the script down below.

"Error: Failed to set the user properties
        The error code was [-2147016651]
        The error text was [Win32::OLE(0.1601) error 0x80072035: "The server
is unwilling to process the request" in METHOD/PROPERTYGET "SetInfo"]"

I have narrowed it down to the line that reads:

        $shadow->Put ("userAccountControl", 512);

If I comment that line out, I no longer get the error message, the Account
is created, but the Account is disabled.  Any ideas on what I'm doing wrong?

Thanks,
Chris


$User_ADS_Path = "LDAP://$Mail_Server/$Container,$Domain_Naming_Context";;
$dso = Win32::OLE->GetObject("LDAP:");
$ou = $dso->OpenDSObject("$User_ADS_Path", "$Admin", "$Password", 1); #$dso
= Win32::OLE->GetObject($User_ADS_Path);
if (Win32::OLE->LastError != 0)
{
        print "Error: Failed to connect to container $User_ADS_Path\n";
        print "\tThe error code was [" . (0 + Win32::OLE->LastError) .
"]\n";
        print "\tThe error text was [" . Win32::OLE->LastError . "]\n";
        die;
}
#Create the user
$shadow = $ou->Create("User", "CN=$Full_Name"); $shadow->Put
("samAccountName", "$User_Name"); $shadow->Put ("userPrincipalName" ,
"[EMAIL PROTECTED]"); $shadow->Put ("displayName", "$Full_Name");
$shadow->Put ("givenName", "$First_Name"); $shadow->Put ("initials",
"$Middle_Initial"); $shadow->Put ("sn", "$Last_Name"); $shadow->Put
("homeDirectory", "$Home_Directory"); $shadow->Put ("homeDrive", "H:");
$shadow->Put ("scriptPath", "storeprof.bat"); $shadow->Put ("description",
"$Description"); $shadow->Put ("userAccountControl", 512);
$shadow->SetPassword("$User_Password");
$shadow->SetInfo();
if (Win32::OLE->LastError != 0)
{
        print "Error: Failed to set the user properties\n";
        print "\tThe error code was [" . (0 + Win32::OLE->LastError) .
"]\n";
        print "\tThe error text was [" . Win32::OLE->LastError . "]\n";
        die;
}
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

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

Reply via email to