WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADSI
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ADSI Function Equivalent to wntMemberSet


Question:

I'm trying to add AD groups to local workstations (XP). I have been able to use wntMemberset to add the AD & NT groups in the past. But because of network issues, I need to use the DNS name instead of %domain%\%username% as before. wntMemberSet does not support %domain%.net\%username% syntax. I'm trying to use dsAddToGrp() but I can't quite get the syntax right. Here is the code:
dsAddtoGrp("WinNT://w-intra/7p4h001/Administrators,group", "LDAP://w-intra/CN=%UserName%,OU=Users,OU=MONROEVILLE,DC=w-intra,DC=net")

Answer:

You cannot mix "WinNT" and "LDAP" provider syntax in the same function call. The underlying service gets very cranky about such things.

Here is an example that adds a domain user to the local machines local "user" group:

; Substitute appropriate values for "mymachine", "mydomainserver", and "hsismpson".

gSecurityGroup = "WinNT://mymachine/users,group"

; User AD samAccountName property value to id user.
sUserPath = "WinNT://mydomainserver/hsimpson,user"

dsAddtogrp(gSecurityGroup, sUserPath)
User hsimpson (cn=Homer Simpson in LDAP syntax) is now a member of a local machine's user group.
Article ID:   W15803
File Created: 2004:03:30:15:40:56
Last Updated: 2004:03:30:15:40:56