Using ADSI to add users and groups

Using ADSI to add users and groups

Post by Max Flodé » Wed, 01 Nov 2000 05:37:54



Using ADSI to add users and groups they end up being "pre windows 2000" -
format.
What do I do wrong?


Code example:
function createUser( machine, username, fullname, description, password )
 dim ComputerObj, NewUser

 On Error Resume Next

 Set ComputerObj = GetObject("WinNT://" & machine)
 If Err Then
  createUser = false
  adsiErr()
  exit function
 end if

 Set NewUser = ComputerObj.Create("user", username)
 'NewUser.SetInfo
 If Err Then
  createUser = false
  adsiErr()
  exit function
 end if

 NewUser.SetPassword(password)
 NewUser.Fullname = fullname
 NewUser.Description = description
 NewUser.SetInfo
 If Err Then
  createUser = false
  adsiErr()
  exit function
 end if

 createUser = true

end function

 
 
 

1. Using ADSI to add group to another group across domain.

Hi, I need help adding a NT4 domain global group into a W2k domain local
group using VBScript.  I tried the following code and got and "Unspecified
Error"

----
Option Explicit
Dim oUsr, oGrp, sUsrPath, sGrpPath, smbr, smbrs

sUsrPath = "WinNT://domain/domainglobalgroup,group"
ssGrpPath = "LDAP://CN=domainlocalgroup,OU=someou,dc=domain,dc=com"

Set oUsr = GetObject(sUsrPath)
Set oGrp = GetObject(sGrpPath)
oGrp.Add oUsr.ADsPath

This works, if I switch "sUsrPath" to a LDAP path point to a W2K AD object
in the same domain. The w2k domain is in native mode if that matters.  The 2
domains are set up with a 2 way trust, and I am able to do it manually from
the MMC Active Directory User and Computer.

Thanks,
Kin

2. C++ Parser, Flex and mkparserclass

3. Can I add a group to a group using ADSI?

4. How many innodb_log_file and how many groups

5. Using ADSI to add users and groups...

6. Messanger Service

7. Adding Computer Accounts to Global Groups Using ADSI

8. a nice pine icon for a dedicated PINE xterm

9. ADSI add user to group

10. adding user to a group in adsi

11. Add W2k globals groups to NT4 locals groups with ADSI

12. ADSI and mutliple domains - Adding a user from domain X into a group in domain Y

13. ASP/ASPX Add User to Group Authentification Problem with ADSI