Change of Name in Active Directory and Exchange on premises through Powershell

Hi Friends,

I need a script to perform below tasks for one user using a CSV:

1. Change First Name, Last Name, Display Name (Name, Display) Format
2. Change Email address in Active Directory
3. Access exchange server and change Primary SMTP and add another additional alias

Can any one help me writing a script for this.. If any info needed I can provide. Please help me on this task as it will help us greatly.

PJ
Pavan JoshiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LeoCommented:
Try the script link I have pasted below, there are two scripts one will overwrite the existing data & other will only write if existing attributes are blank.

Prerequisites:- quest management tools should be installed.

https://gallery.technet.microsoft.com/scriptcenter/Feeding-data-to-Active-0227d15c
Will SzymkowskiSenior Solution ArchitectCommented:
This is quite simple. Use the script below. Let me know if you have any issues...

CSV should be constructed like below...

sam            First    Last       DisplayName   NewPrim                                     AdditionalAlias
 msmith     Mike   Smith    Mike Smith       msmith@ex.com         mike.smith@example.com
 jlows          Jean    Lows     Jean Lows          jlows@ex.com                  jean.lows@ex.com

Import-Module activedirectory
Add-PSSnapin microsoft.exchange.management.powershell.admin
$Data = Import-csv "c:\filename.csv"

    ForEach ($line in $Data) 
        {
            $line.sam
            $line.First
            $line.Last
            $line.DisplayName
            $line.NewPrim
            $line.AdditionalAlias

            Set-ADUser -Identity $line.sam -GivenName $line.First -Surname $line.Last -DisplayName $line.DisplayName

            Set-Mailbox -Identity $line.sam -EmailAddressPolicyEnabled $false -EmailAddresses $line.AddtionalAlias

            Set-Mailbox -Identity $line.sam -PrimarySmtpAddress $line.NewPrim


}

Open in new window


You need to change the second line "Add-PSSnapin" to whatever version of Exchange you are running. You need to have both Active Directory and Exchange snapins in the powershell session for this to work as we are calling different cmdlets.

Will.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pavan JoshiAuthor Commented:
I've requested that this question be deleted for the following reason:

I got the answer
Check Out How Miercom Evaluates Wi-Fi Security!

It's not just about Wi-Fi connectivity anymore. A wireless security breach can cost your business large amounts of time, trouble, and expense. Plus, hear first-hand from Miercom on how WatchGuard's Wi-Fi security stacks up against the competition plus a LIVE demo!

Will SzymkowskiSenior Solution ArchitectCommented:
All that work and your clsoing the question, with no explaination? I have tested my script and it does exactly what you asked.

Will.
LeoCommented:
@Pavan, please share the solution which you have found.....
Pavan JoshiAuthor Commented:
Thank you so much and appreciate your quick response for every question of mine in the  forum. It's been a pleasure working with you. Your encouragement comes as a gift rather than an option. Thanks again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.