View Single Post
Old 08-07-2007   #1 (permalink)
Thomas M.


 
 

Add User to AD Group

I'm new to PowerShell and I'm trying to create a script that will add a user
to an Active Directory group. I copied the following code out of a book
into PrimalScript 4.1 Enterprise and modified it for my environment. I've
sanitized the code (force of habit when posting on the Internet).

xxxx = My division OU
yyy = My agency OU
zz = My state

Dim objGroup

set objGroup = GetObject _
("LDAP://CN=UserRightsExceptions,CN=Groups,CN=UserRightsTesting,CN=xxxx,CN=yyy,DC=state,DC=zz,DC=ads")
objGroup.add _
("CN=CXLMTUSR,OU=LimitedUsers,OU=UserRightsTesting,OU=xxxx,OU=yyy,DC=state,DC=zz,DC=ads")
objGroup.SetInfo

So basically, I want to add the user named CXLMTUSR to the
UserRightsExceptions group in Active Directory. I have confirmed that both
distinguished names are correct, assuming no syntax errors. When I run the
script I get the following error:

<Path>\AddUserToGroup.vbs(3, 1) (null): There is no such object on the
server.
Exit code: 0 , 0000h

where <Path> is the full path to the script file.

Can someone show me what I am doing wrong?

--Tom


My System SpecsSystem Spec