Solved

DSmod question

Posted on 2009-04-14
4
961 Views
Last Modified: 2012-08-14
I need to change the displayname attribute of every user in my active directory structure.  I was going to us dsquery and pipe the results to dsmod, but I need to know if I can use active directory attributes to define what I want changed.  For instance I was thinking:

dsquery user "ou=my ou,dc=mycompany,dc=com" | dsmod user -display lastname & firstname

but obviously I don't know how to pull the attributes for the firstname and lastname in ad.  Does anybody know?
0
Comment
Question by:DustinHinkel
4 Comments
 
LVL 58

Assisted Solution

by:tigermatt
tigermatt earned 150 total points
ID: 24140487

Rather than script it, I'd suggest you use ADModify.NET. This is a tool for bulk modifying Active Directory objects, and you can obtain it from http://www.codeplex.com/admodify.

In the tool, having set the scope of the changes you need to make and selecting the user accounts, you'd check the Display Name option and enter %'sn'%, %'givenName'% in order to set it as Last Name, First Name for all the objects you selected. sn and givenName are actual Active Directory attribute names for last name and first name.

-Matt
0
 
LVL 6

Assisted Solution

by:ngailfus
ngailfus earned 150 total points
ID: 24140498
We use ADModify to perform bulk changes to accounts.  One of the built in options is to change everyone to lastname, firstname.

http://www.codeplex.com/admodify

0
 
LVL 57

Accepted Solution

by:
Mike Kline earned 200 total points
ID: 24141182
Excellent suggestion by Matt as usual, admodify is great. (and you can undo changes if you make a mistake using admodify)
Another way to do it via the command line is to use adfind and admod by MVP Joe Richards
I wrote a blog entry on that here:
http://adisfun.blogspot.com/2009/04/modify-user-displayname-using-command.html
Thanks
Mike
0
 

Author Comment

by:DustinHinkel
ID: 24142954
Thanks for the suggestions guys.  In the meantime I found and edited a vbs script.  I attached the code in case anybody was curious.  It's pretty simple.  I'll distribute points.
set objparent = GetObject("LDAP://ou=people,dc=mydomain,dc=com")
objparent.Filter = Array("user")
for each objUser in objparent
objuser.displayname = objuser.get("sn") & ", " & objuser.get("givenname")
objuser.setinfo
next

Open in new window

0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This article explains how to install and use the NTBackup utility that comes with Windows Server.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question