I am trying to create a user in a 2000 domain Active Directory. Ideally, I would like to create the user in a specific OU, however, I can't seem to get the user to appear anywhere (even in the default area "USERS").

I am using the following code, but remember, I am new to the COM portion of KIX 2001...

code:
 

$DomainObj = GetObject("LDAP://domain") ;Connect to domain
IF NOT $DomainObj = 0 ;Confirm connection
$UserObj = $DomainObj.Create("user", "jdoe") ;Create a new user
IF NOT $UserObj = 0 ;Confirm new user
$UserObj.CN = "John Doe" ;Write all information to user
$UserObj.SamAccountName = "Jdoe"
$UserObj.UPN = "Jdoe@sd38.ca"
$UserObj.Password = "Temporary"
$UserObj.givenName = "John"
$UserObj.sn = "Doe"
$UserObj.SetInfo ;Save changes to account
ELSE
? @ERROR
?
? @SERROR
ENDIF
ELSE
? @ERROR
?
? @SERROR
ENDIF


The results of this code, seem to be good. There are no errors, and the code runs through to completion. The user, however, does not appear in the Active Directory. All references, that I can find, say that a user in 2000 only requires a Common Name (CN) and a Sam Account Name to be created.

Help Please...

--Jonathan

[ 01 March 2002: Message edited by: Jonathan ]