Skip to content

Latest commit

 

History

History
150 lines (112 loc) · 4.7 KB

README.md

File metadata and controls

150 lines (112 loc) · 4.7 KB

Logo

Update-UserUPN


Explore the docs »

Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. Acknowledgements

About The Project

This module was written as part of a project to migrate all users to Exchange online. A requirement for this was to have all users email addresses and UPNs match. This script looks up a user based on their SamAccountName or by OU and updates their UPN to match their EmailAddress

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • This has been tested in Powershell V5.1 and V7
  • Active Directory PowerShell module
  • Appropriate domain suffixes configured in Active Directory

Installation

  1. This module is available via the Powershell Gallery
Install-Module -Name Update-UserUPN

Usage

  • Assuming user Joe Bloggs AD Object looks like this
User UPN Logon - Bloggs.Joe@company.contoso.com 
User SamAccountName Logon - domain\bloggs.joe
E-Mail - joe.bloggs@contoso.com 
  1. This will update Joe Bloggs UPN to match his email address but leave his SamAccountName unchanged
Update-UserUPN -SamAccountName bloggs.joe
  1. This will update the UPN's of all users, in the OU specified, to match their email address
Update-UserUPN -OU "OU=UsersSubOU,OU=Users,DC=company,DC=com"
  1. This will produce a list of the users current UPN and what their UPN will become (Email Address) should you run either of the above commands, As well as their AD Description (This was more for my benefit and can easily be removed or modified)
Update-UserUPN -OU "OU=UsersSubOU,OU=Users,DC=company,DC=com" -ReportOnly

UserPrincipalName            EmailAddress                     Description
-----------------            ------------                     -----------
Bloggs.Joe                   Joe.Bloggs@domain.com            Developer
BGatesUPN                    Bill.Gates@domain.com            Developer
APersonUPN                   Angela.Person@domain.com         Developer

Update-UserUPN -SamAccountName bloggs.joe -ReportOnly

UserPrincipalName            EmailAddress                     Description
-----------------            ------------                     -----------
Bloggs.Joe                   Joe.Bloggs@domain.com            Developer

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Acknowledgements