Greg Altman

IT Leader, Writer, Speaker

Menu
  • Home
  • Speaking
  • About Me
  • Reviews
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

Category: PowerShell

Categories

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

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