Solved

DSmod question

Posted on 2009-04-14
4
957 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Read this checklist to learn more about the 15 things you should never include in an email signature.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now