[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Powershell command to change user Fullname

Posted on 2011-04-19
3
Medium Priority
?
8,152 Views
Last Modified: 2012-06-27
I have successfully used the following powershell script to modify the Diplay Name of existing users in our AD one specified OU at a time:

Get-ADUser -Filter * -SearchBase "OU containing users to change" -Properties DisplayName, Initials | % {Set-ADUser $_ -DisplayName ($_.Surname + ' ' + $_.GivenName + ' ' + $_.Initials)}  

I am trying to find a similar script that will apply the same change to the Full Name as well (the get-aduser property appears to be called just 'Name') but set-aduser doesn't appear to accept -Name or -FullName and I can't seem to find an equivilent in the help for set-aduser.  Does anyone have an alternative suggestion?  Would prefer powershell, but I want to be able to keep the script and use it to update users one OU at a time.
0
Comment
Question by:PtboGiser
2 Comments
 
LVL 43

Accepted Solution

by:
Adam Brown earned 2000 total points
ID: 35425999
The Name attribute represents the actual CN= value of the user object, and can't be changed with set-aduser. You have to utilize the rename-adobject cmdlet to do this. The attached code would do it.
rename-adobject -identity (get-aduser <username>).distinguishedname -newname <new name>

Open in new window

0
 

Author Closing Comment

by:PtboGiser
ID: 35474974
Perfect, thanks so much!!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
A bad practice commonly found during an account life cycle is to set its password to an initial, insecure password. The Password Reset Tool was developed to make the password reset process easier and more secure.
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
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 to another domain controller. Log onto the new domain controller with a user account t…

873 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