Using ADSI to add users and groups...

Using ADSI to add users and groups...

Post by Max Flodé » Wed, 01 Nov 2000 05:41:02



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


Reposting, sorry

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

 
 
 

Using ADSI to add users and groups...

Post by Marc Scheune » Wed, 01 Nov 2000 22:24:12




Quote:>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)

Maybe you need to use the LDAP provider for AD instead of the
(old-style) WinNT: provider......

Something like:

Set ComputerObj = GetObject("LDAP://domain/cn=" & machine &
",dc=yourdomain,dc=com")

Marc

 
 
 

Using ADSI to add users and groups...

Post by marv » Sat, 04 Nov 2000 07:11:15


Do something like this instead,

Set salesOU = GetObject("LDAP://OU=Sales,DC=ArcadiaBay,DC=COM")
Set usr = salesOU.Create("user", "CN=Julie Adam")
usr.Put "samAccountName", "juliea"

usr.Put "title" "Marketing Manager"
usr.SetInfo

 
 
 

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. using the Dynamic linker for run time apps

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

4. HELP: IBM PC/MAC LaserWriter Cable

5. Using ADSI to add users and groups

6. SYSBAR Task Switcher tip

7. Adding Computer Accounts to Global Groups Using ADSI

8. SUGGESTION - How to make Samba a PDC

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