Changing Outlook’s Email Display Remotely

So you’ve changed your email domain and want to make the necessary cosmetic changes to Outlook.

You’ve moved your users over from user@olddomain.com to user@newdomain.com and everything is working great. The only issue is that in Outlook it’s still displaying the old domain in the email address. Surely there’s an easy way to update everyone remotely all at once, right?

Sadly, as far as I’ve found, it’s not going to be a mass change you can make. You’re going to have to do this for each individual user.

Fear not though, as you can make this a little easier on yourself (and if anyone knows how to make it better we’re all ears).

As always, PDQ Deploy is your ideal tool for this job. It can be found at www.PDQ.com and installed with ease if you don’t already have it.

Once you’ve fired up Deploy, you’ll need to create a Visual Basic Script (VBScript) and place it in a location which everyone can access.

Simply copy the code found below into a notepad, and save it as OutlookUpdater.vbs (or whatever you prefer just so long as it has .vbs as the file extension). This script is not my own, it was found elsewhere on the internet. It essentially updates the mail profile display in Outlook.

Dim colStores ‘As Outlook.Stores
Dim oStore ‘As Outlook.Store
Dim oRoot ‘As Outlook.folder
Dim oldName
Dim newName ‘As String

oldName = “user@olddomain.com”
newName = “user@newdomain.com”

‘On Error Resume Next

Set objOutlook = CreateObject(“Outlook.Application”)
Set colStores = objOutlook.Session.Stores

For Each oStore In colStores
Set oRoot = oStore.GetRootFolder

If oRoot = oldName Then
oRoot.Name = newName
End If

Next

Now create a new package in Deploy, and under package settings ensure that it is set to run as the logged on user. The script must be ran under the logged on user’s context in order to work.

For the first step, choose a command and use: taskkill /F /IM outlook.exe
The second step will be Powershell: cscript “\\server\folder\OutlookUpdater.vbs”
Then a third command: start outlook.exe

This forces Outlook to stop, runs the script, and then starts Outlook. The script will not run if Outlook is running, though interestingly enough, if you run the script directly on the computer, it will run with Outlook open. If anyone knows why that is, we’d be happy to hear in the comment section.

On the first step, you will also need to include 128 as a success code in case Outlook isn’t running when you execute this package.

Now go back into your VB script and edit the email address in these two lines for each deployment to a user’s computer:

oldName = “user@olddomain.com”
newName = “user@newdomain.com”

Keep in mind that oldName is case sensitive (hopefully your AD is consistent with its format), otherwise it will not work. The newName line will update Outlook to display whatever you want the new email address to be.

Save the script each time you put in a new email address and deploy it out to the next user.

While still time consuming, this does allow you to update without remoting into the computer or requiring the end user to do anything, and takes about 30 seconds each time.

This has been tested on Outlook 2010, 2013, and 2016. It should work on all versions though.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: