Solved

DSmod question

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

Are end users causing IT problems again?

You’ve taken the time to design and update all your end user’s email signatures, only to find out they’re messing up the HTML, changing the font and ruining the imagery. What can you do to prevent this? Find out how you can save your signatures from end users today.

Join & Write a Comment

Resolve DNS query failed errors for Exchange
Easy CSR creation in Exchange 2007,2010 and 2013
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

757 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

21 Experts available now in Live!

Get 1:1 Help Now