kevaroo
asked on
An invalid dn syntax has been specified - VBScript to rename a group in AD2000
Hi,
I am trying to write a VBscript that will rename a mail enabled group in AD 2000 and then amend some of the attributes. If I hard code the LDAP query it works fine, but when I try to use a variable for the input of the group names it falls over at the below line
objDomain.MoveHere "LDAP://cn=" & strCurrentName & ",ou=Distribution Lists,dc=domain,dc=net", "cn=" & strNewName &""
the error message is
Char: 1
Error: An invalid dn syntax has been specified
Code: 80072032
Source: (null)
I am trying to write a VBscript that will rename a mail enabled group in AD 2000 and then amend some of the attributes. If I hard code the LDAP query it works fine, but when I try to use a variable for the input of the group names it falls over at the below line
objDomain.MoveHere "LDAP://cn=" & strCurrentName & ",ou=Distribution Lists,dc=domain,dc=net", "cn=" & strNewName &""
the error message is
Char: 1
Error: An invalid dn syntax has been specified
Code: 80072032
Source: (null)
dim strCurrentName, strNewName
strCurrentName = InputBox ("Group Name to be Renamed:","Enter Current Group Name")
if strCurrentName = "" then
wscript.quit
end if
strNewName = InputBox ("New Name of Group:","Enter New Group Name")
if strNewName = "" then
wscript.quit
end if
Set objDomain = GetObject("LDAP://cn=" & strCurrentName & ",ou=Distribution Lists,dc=domain,dc=net")
objDomain.MoveHere "LDAP://cn=" & strCurrentName & ",ou=Distribution Lists,dc=domain,dc=net", "cn=" & strNewName &""
set objuser = GetObject("LDAP://cn=" & strNewName & ",ou=Distribution Lists,dc=domain,dc=net")
objUser.sAMAccountName = strNewName
objuser.displayName = strNewName
objuser.mailNickname = strNewName
objUser.SetInfo
MsgBox("Finished")
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks alot Chris,
Your soltuion works fine.
Kev
Your soltuion works fine.
Kev
Always a pleasure :)
Chris
ASKER
Kev