' This script was originally published in the Exchange Cookbook,
' (http://www.exchangebookcook.com). Written by Paul Robichaux,
' Missy Koslosky, and Devin Ganger. Redistributed with permission
' of the publisher, O'Reilly & Associates.
' This script flips the display name of existing objects to "lastname, firstname"
' ------ SCRIPT CONFIGURATION ------
strDCName = "<serverName>" ' e.g. "Batman"
strTargetContainer = "<OU or container>" ' e.g. "cn=users, dc=robichaux, dc=net"
' ------ END CONFIGURATION ---------
Set theTargetOU = GetObject("LDAP://" & strTargetContainer)
theTargetOU.Filter = Array("user")
For each userItem in theTargetOU
if instr(userItem.samAccountName, "$") = 0 then
vLast = userItem.get("Sn")
vFirst = userItem.get("GivenName")
vFullname = vLast + ", " + vFirst
userItem.put "displayName", vFullName
userItem.setinfo
WScript.echo userItem.samAccountName " is now " & userItem.displayName
end if
Next
|