Windows Server 2008 Thread, Changing display name to userlogon name in Technical; Hi,
before all our mail accounts are created I want to change our old students in an OU 'display name' ...
14th September 2010, 02:52 PM #1
Changing display name to userlogon name
before all our mail accounts are created I want to change our old students in an OU 'display name' to their 'logon name' (numbers), currently their display name is their first and second names. Is there an easy way to do automate this change?
14th September 2010, 03:28 PM #2
- Rep Power
A VBscript targetted at all user accounts in the OU would accomplish this quite easily:
'Bind to the relevant OU
Set objOU = GetObject("LDAP://ou=OUNAME,dc=DOMAINNAME")
'Filter the OU contents into an array of users
objOU.Filter = Array("user")
'Read the logon name
For Each objUser In objOU
strDisplayName = objUser.Get("sAMAccountName")
'Set the display name to be the same as the logon name
objUser.Put "displayName", strDisplayName
This was written in haste - please excuse any errors. I suggest testing it on an OU with a single account first.
No warranty is implied or given, etc, etc, etc...
Thanks to taff from:
Theblacksheep (14th September 2010)
14th September 2010, 06:38 PM #3
Thanks for that taff, I don't know much VBscript so its a very handy, thankyou.
By pooley in forum EduGeek Joomla 1.5 Package
Last Post: 24th March 2010, 02:35 PM
By leco in forum Hardware
Last Post: 25th February 2010, 10:10 AM
By Avalon in forum EduGeek Joomla 1.5 Package
Last Post: 19th November 2009, 07:06 PM
By RabbieBurns in forum Web Development
Last Post: 5th March 2009, 04:51 PM
By FN-GM in forum Scripts
Last Post: 15th February 2008, 11:35 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)