Home > Exchange, Microsoft, Powershell > Powershell script to change User Principal Name to Primary SMTP Address

Powershell script to change User Principal Name to Primary SMTP Address

When you install Exchange in environment you want to allow users to log into mails using their e-mail address. If your domain name is different from your e-mail domain, you have to add UPN suffix first. More abour it HERE. Then you need to change User Principal Name into Primary SMTP Address. I wrote little script to do so:

Get-Mailbox |
   Write-Host “For: ” + $_.SamAccountName
   Write-Host ”   – change UPN from: ” + $_.UserPrincipalName + ” to: ” + $_.PrimarySmtpAddress
   Set-ADUser -Identity $_.DistinguishedName -UserPrincipalName $_.PrimarySmtpAddress

Have a nice day,

Categories: Exchange, Microsoft, Powershell Tags: ,
  1. January 14th, 2020 at 17:01 | #1

    Do you have any video of that? I’d like to find out some additional information.

  2. January 24th, 2020 at 10:33 | #2

    I am in fact grateful to thee holder of this web page who has shared
    this enormous post at att this place.

  3. January 24th, 2020 at 11:00 | #3

    I’m amazed, I must say. Rarely do I encounter a blog that’s both equally educative
    and entertaining, and without a doubt, you have hit the nail on the head.
    The issue is something which too few folks are speaking intelligently about.

    Now i’m very haqppy that I found this during my hjnt for something
    concerning this.

  4. January 24th, 2020 at 12:14 | #4

    My coder is trying too persuade me to move to .net from PHP.
    I havge always disliked the idea because of the costs. But he’s tryiong none the less.
    I’ve been using Movable-type on various websites for about a year and am anxious about
    switching to another platform. I have heard excellent things about blogengine.net.

    Is there a waay I can import all my wordpress posts into it?
    Any help would be really appreciated!

  5. January 24th, 2020 at 14:32 | #5

    It’s an awesome article in favor oof all the internet viewers; they will
    take advantage from it I am sure.

  6. January 24th, 2020 at 15:00 | #6

    you’re in reality a just right webmaster. The website loading sppeed is amazing.
    It seems that you are doing any uunique trick. In addition, The
    contents are masterpiece. you have performed a fantastic activity in this subject!

  1. December 14th, 2016 at 15:17 | #1