Skip to content

Greg Altman

Solutions, Learnings, PowerShell, and random thoughts.

Menu
  • Home
  • Tech Reviews
  • Github Repos
  • About Me
Menu

Powershell Tuesday Quick Tip #5

Posted on April 3, 2018 by Greg Altman

Here’s another one from the easy but annoying to rethink stack.
People, as someone once said, are ‘squishy and move around a lot’. Not only do they move but they change and sometimes the change involves their names.
For example, the customer service person gets married or the sales manager gets divorced.(Hopefully not for the same reason – but that’s a different blog)

So you can either fire up the Active Directory tool of your choice (ADAC or ADUC) OR switch over to your PowerShell console that you have open already.
… you DO have it open already right?

[code lang=’powershell’]
Set-AdUser -Identity Leia -Surname ‘Solo’ -DisplayName “Leia Solo”
Set-Mailbox -Identity Leia -PrimarySmtpAddress ‘LeiaSolo@NewRepublic.gov’ -EmailAddressPolicyEnabled:$False -DisplayName ‘Leia Solo’ -EmailAddresses @{add =’LeiaOrgana@NewRepublic.gov’}
[/code]

The first line “Set-ADUser” changes Leia’s surname to Solo and corrects her display name. The second line, “Set-Mailbox” changes her primary email address to “LeiaSolo@NewRepublic.gov” along with her display name while adding her original email address back in as an alternate. This is so Leia will continue to get email from some people that haven’t gotten the happy news yet.

These two lines require that you have the Active Directory module and a remote session to either Office365 or your Exchange server.

Next week I’ll be blogging from the PowerShell + DevOps Global Summit in beautiful Bellevue WA!

 

Share this:

  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

Disclaimer: The thoughts, ideas and code on this blog are my own and do not represent any employer, past or present. All code is for demonstration and educational purposes only. Use at your own risk

Categories

  • Ad-hoc and Random
  • Blog
  • Career
  • Cloud
  • Events
  • PowerShell
  • Reviews
  • Security
  • Server Stuff
  • Troubleshooting
  • Uncategorized

Overall Rating
0.0
© 2025 Greg Altman | Powered by Minimalist Blog WordPress Theme
%d