Hi Raymond,

Here is some VBScript code that sets the userPrincipalName for all users in
a particular OU:

'---------------------

strOU = "ou=customers"
strDomain = "ad-vm1.cisco.com"

set objRootDSE = GetObject("LDAP://"; & strDomain & "/RootDSE")
set objParent = GetObject("LDAP://"; & strOU & "," & _
                          objRootDSE.Get("defaultNamingContext"))
objParent.Filter = Array("user")
for each objUser in objParent
    Wscript.Echo "Modifying " & objUser.Get("sAMAccountName")
    objUser.Put "userPrincipalName", _
                 objUser.Get("sAMAccountName") & "@" & strDomain
    objUser.SetInfo
next

'---------------------

Let me know if you were looking for something different or have any
questions.

Regards,
Robbie Allen
http://www.rallenhome.com/


> -----Original Message-----
> From: Raymond McClinnis [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, September 06, 2003 12:26 PM
> To: [EMAIL PROTECTED]
> Subject: [ActiveDir] Script to populate the Windows 2000 user 
> name in AD
> 
> 
> After our upgrade to Windows 2000 I noticed that the windows 
> 2000 user name
> field did not auto populate.  I don't know whether it should 
> have or not
> though.  I tried to get all of the help desk personnel to 
> update this field
> whenever they accessed an user acct to reset the password or 
> whatever, but
> I'm afraid it may have fallen on deaf ears.  Is there any way to run a
> script that will take the pre-windows 2000 username and 
> populate the windows
> 2000 user name (of course adding the @domain.int)
> 
> 
> Any help will be much apreciated
> 
> Thanks,
> 
> Raymond McClinnis
> Network Administrator
> Provident Credit Union
> 
> 
> List info   : http://www.activedir.org/mail_list.htm
> List FAQ    : http://www.activedir.org/list_faq.htm
> List archive: 
> http://www.mail-archive.com/activedir%> 40mail.activedir.org/
> 
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to