Global change of Company Name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there an easy way to change the company field for an entire domain (approx
100 or so users)?

Our company just changed names, and I am hoping there is a way to update
this field one time instead of going to each user object and changing it
manually.

Thanks
 
If you are using 2003 you can highlight all the users to change and select
properties and go to the "Organization" tab and enter it there and it will
modify them all.

--


Paul Bergson MCT, MCSE, MCSA, CNE, CNA, CCA

This posting is provided "AS IS" with no warranties, and confers no rights.
 
We are using 2000.

Paul Bergson said:
If you are using 2003 you can highlight all the users to change and select
properties and go to the "Organization" tab and enter it there and it will
modify them all.

--


Paul Bergson MCT, MCSE, MCSA, CNE, CNA, CCA

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi,

Then you will need a scripting solution. You can look into the command line
utilties csvde and ldifde.

You can use VBScript. If you are sure you want to change this for all user
objects in the domain, you can use ADO to retrieve the Distinguished Name
for all users, bind to each, modify the "company" attribute, and invoke
SetInfo to commit the change. If all users are in one or a few
containers/OU's, you can bind to the container, filter on user objects,
enumerate the users, modify "company", and SetInfo. For one OU:

' Specify container/OU.
Set objOU = CreateObject("LDAP://ou=Sales,dc=MyDomain,dc=com")
' Filter on user objects.
objOU.Filter = Array("user")
' Enumerate user objects.
For Each objUser In objOU
' Modify "company" attribute.
objUser.company = "New Company Name, Inc."
' Commit change.
objUser.SetInfo
Next

Or, using ADO to retrieve all users regardless of their location in the
domain:

' Use ADO to search the domain for all users.
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOOBject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection

' Determine the DNS domain from the RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strFilter = "(&(objectCategory=person)(objectClass=user))"
strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter _
& ";distinguishedName;subtree"

objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False

' Enumerate all users.
Set objRecordSet = objCommand.Execute
Do Until objRecordSet.EOF
' Retrieve user Distinguished Name.
strDN = objRecordSet.Fields("distinguishedName").Value
' Bind to the user object.
Set objUser = GetObject("LDAP://" & strDN)
' Modify "company" attribute.
objUser.company = "New Company Name, Inc."
' Commit change.
objUser.SetInfo
objRecordSet.MoveNext
Loop
Wscript.Echo "Done"
 
(all one line)

adfind -default -f objectcategory=person -dsq | admod -unsafe "company::New Name"
 
Back
Top