Jump to content

Recommended Posts

Posted

Hi,

 

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?

Posted

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

objUser.SetInfo

Next

 

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 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...