RE: [ActiveDir] Script to populate the Windows 2000 user name in AD
Title: Message Hello Robbie, Thanks for this, in the script you mention ADO would be better do you have an example of this? Thanks -Original Message-From: Robbie Allen [mailto:[EMAIL PROTECTED]Sent: 10 November 2003 13:58To: '[EMAIL PROTECTED]'Subject: RE: [ActiveDir] Script to populate the Windows 2000 user name in AD Hi Graham. Try this out: http://www.rallenhome.com/books/adcookbook/src/06.04-modify_upn_for_users3--additional.vbs.txt Let me know if you have any questions. Regards, Robbie Allen -Original Message-From: Graham Swift [mailto:[EMAIL PROTECTED] Sent: Monday, November 10, 2003 7:39 AMTo: [EMAIL PROTECTED]Subject: [ActiveDir] Script to populate the Windows 2000 user name in AD Hello, I have read a post on how to modify the username on a per OU basis, How would this be changed to apply toall users in the domain? The previously posted message is: '-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.SetInfonext'-Thanks to robbie allen. This is great althoiugh we have lots of OUs and would appereciate the help in doing this for the entire domain. Graham Swift IT Technical Analyst William Sutton Trust == DDI: 01442 821215 Fax: 01442 821228 Email: [EMAIL PROTECTED] Web: http://www.williamsutton.org.uk **This email and any files transmitted with it are confidential andintended solely for the use of the individual or entity to whom theyare addressed. Please note that William Sutton Trust is able to, andreserves the right to, monitor e-mail communication passing throughits network.If you have received this email in error please notify our mail managerat [EMAIL PROTECTED]This footnote also confirms that this email message has been swept byMIMEsweeper for the presence of computer viruses.Ver 1.0.2000 William Sutton Trust IT ServicesWilliam Sutton is a registered Charity No. 205847 **
RE: [ActiveDir] Script to populate the Windows 2000 user name in AD
Title: Message Here is what I use, certainly based on one of Robbie's examples from somewhere: Option Explicit Dim oRootDSE 'As IADsDim objUser 'As IADsUserDim oConnection 'As New ADODB.ConnectionDim oCommand 'As New ADODB.CommandDim RS 'As ADODB.RecordsetDim strQuery 'As String, Dim newattrib 'As StringDim varDomainNC 'As Variant 'On Error Resume Next ' Get the Configuration Naming ContextSet oRootDSE = GetObject("LDAP://RootDSE")varDomainNC = oRootDSE.Get("defaultNamingContext")wscript.echo varDomainNC ' Open the Connectionset oConnection = Wscript.CreateObject("ADODB.Connection")oConnection.Provider = "ADsDSOObject"oConnection.Open "ADs Provider" 'Build a query to find all usersstrQuery = "LDAP://" varDomainNC ";((objectClass=user)(objectCategory=person));adspath,cn;subtree" set oCommand = Wscript.CreateObject ("ADODB.Command")oCommand.ActiveConnection = oConnectionoCommand.CommandText = strQuerySet RS = oCommand.Execute If RS.RecordCount = 0 Then Wscript.echo "No Users found"Else While Not RS.EOF Set objUser = GetObject(RS.Fields("adspath")) Wscript.echo objUser.cn RS.MoveNext WendEnd IfSet oRootDSE = NothingSet objUser = NothingRS.Closeset RS = Nothing From: Graham Swift [mailto:[EMAIL PROTECTED] Sent: Monday, November 10, 2003 9:11 AMTo: [EMAIL PROTECTED]Subject: RE: [ActiveDir] Script to populate the Windows 2000 user name in AD Hello Robbie, Thanks for this, in the script you mention ADO would be better do you have an example of this? Thanks -Original Message-From: Robbie Allen [mailto:[EMAIL PROTECTED]Sent: 10 November 2003 13:58To: '[EMAIL PROTECTED]'Subject: RE: [ActiveDir] Script to populate the Windows 2000 user name in AD Hi Graham. Try this out: http://www.rallenhome.com/books/adcookbook/src/06.04-modify_upn_for_users3--additional.vbs.txt Let me know if you have any questions. Regards, Robbie Allen -Original Message-From: Graham Swift [mailto:[EMAIL PROTECTED] Sent: Monday, November 10, 2003 7:39 AMTo: [EMAIL PROTECTED]Subject: [ActiveDir] Script to populate the Windows 2000 user name in AD Hello, I have read a post on how to modify the username on a per OU basis, How would this be changed to apply toall users in the domain? The previously posted message is: '-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.SetInfonext'-Thanks to robbie allen. This is great althoiugh we have lots of OUs and would appereciate the help in doing this for the entire domain. Graham Swift IT Technical Analyst William Sutton Trust == DDI: 01442 821215 Fax: 01442 821228 Email: [EMAIL PROTECTED] Web: http://www.williamsutton.org.uk **This email and any files transmitted with it are confidential andintended solely for the use of the individual or entity to whom theyare addressed. Please note that William Sutton Trust is able to, andreserves the right to, monitor e-mail communication passing throughits network.If you have received this email in error please notify our mail managerat [EMAIL PROTECTED]This footnote also confirms that this email message has been swept byMIMEsweeper for the presence of computer viruses.Ver 1.0.2000 William Sutton Trust IT ServicesWilliam Sutton is a registered Charity No. 205847 **
RE: [ActiveDir] Script to populate the Windows 2000 user name in AD
Graham and Robbie Why not simply add ad-vm1.cisco.com to your UPN at the Domain and Trust level or in ADSIEDIT? Much as I like scripting tasks, I don't quite understand the purpose here. Sincerely, Dèjì Akómöláfé, MCSE MCSA MCP+I www.akomolafe.com www.iyaburo.com Do you now realize that Today is the Tomorrow you were worried about Yesterday? -anon From: [EMAIL PROTECTED] on behalf of Graham Swift Sent: Mon 11/10/2003 6:10 AM To: [EMAIL PROTECTED] Subject: RE: [ActiveDir] Script to populate the Windows 2000 user name in AD Hello Robbie, Thanks for this, in the script you mention ADO would be better do you have an example of this? Thanks -Original Message- From: Robbie Allen [mailto:[EMAIL PROTECTED] Sent: 10 November 2003 13:58 To: '[EMAIL PROTECTED]' Subject: RE: [ActiveDir] Script to populate the Windows 2000 user name in AD Hi Graham. Try this out: http://www.rallenhome.com/books/adcookbook/src/06.04-modify_upn_for_users3--a dditional.vbs.txt Let me know if you have any questions. Regards, Robbie Allen -Original Message- From: Graham Swift [mailto:[EMAIL PROTECTED] Sent: Monday, November 10, 2003 7:39 AM To: [EMAIL PROTECTED] Subject: [ActiveDir] Script to populate the Windows 2000 user name in AD Hello, I have read a post on how to modify the username on a per OU basis, How would this be changed to apply to all users in the domain? The previously posted message is: '- 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 '- Thanks to robbie allen. This is great althoiugh we have lots of OUs and would appereciate the help in doing this for the entire domain. Graham Swift IT Technical Analyst William Sutton Trust == DDI: 01442 821215 Fax: 01442 821228 Email: [EMAIL PROTECTED] Web:http://www.williamsutton.org.uk http://www.williamsutton.org.uk/ ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Please note that William Sutton Trust is able to, and reserves the right to, monitor e-mail communication passing through its network. If you have received this email in error please notify our mail manager at [EMAIL PROTECTED] This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. Ver 1.0.2000 William Sutton Trust IT Services William Sutton is a registered Charity No. 205847 ** winmail.dat
RE: [ActiveDir] Script to populate the Windows 2000 user name in AD
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/
RE: [ActiveDir] Script to populate the Windows 2000 user name in AD
This should work perfectly. Thank you Mr. Allen Thanks, Raymond McClinnis Network Administrator Provident Credit Union 650-508-0300 X2557 800-632-4600 X2557 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robbie Allen Sent: Saturday, September 06, 2003 11:44 AM To: '[EMAIL PROTECTED]' Subject: RE: [ActiveDir] Script to populate the Windows 2000 user name in AD 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/ 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/