Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VBScript - Active Directory

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,871
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBScript - Active Directory
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VBScript - Active Directory - 7/9/2003 6:18:10 AM   
  Bergkristall2001

 

Posts: 4
Score: 0
Joined: 7/3/2003
From:
Status: offline
How can I change the common name of a user with a vbscript in Active Directory? I know how to change the display name and description an so on, but not the full name, common name and user.name.
 
 
Post #: 1
 
 Re: VBScript - Active Directory - 7/11/2003 12:36:04 AM   
  Bergkristall2001

 

Posts: 4
Score: 0
Joined: 7/3/2003
From:
Status: offline
I found a solution:
 
'Weist dem Attribut Description den Wert des Attributs Common-Name zu und benennt User mit Wert aus Description um.

Dim strTargetOU

strTargetOU = "OU=Users,OU=Accounts,OU=yyy,OU=DE,DC=mydomain,DC=xxx,DC=com"

Set oTargetOU = GetObject("LDAP://" & strTargetOU)
oTargetOU.Filter = Array("User")

For each usr in oTargetOU
if instr(usr.cn, "test") then
vTempDescription = usr.description
usr.description = usr.cn
usr.SetInfo
strName = "cn=" & vTempDescription
Set domainDNS = GetObject ("LDAP://DC=mydomain,DC=xxx,DC=com")
Set ou = domainDNS.GetObject("organizationalUnit", "OU=Users,OU=Accounts,OU=yyy,OU=DE")
Set user = ou.GetObject("user", usr.name)
Set newobj = ou.MoveHere(user.ADsPath, strName)
end if
Next

(in reply to Bergkristall2001)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBScript - Active Directory Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts