Your company uses Microsoft Exchange Online. Employees frequently need to change their primary email addresses.
The messaging operations team has requested a script to simplify the process of changing email addresses.
The script must perform the following actions:
Obtain employee information from a .csv file that has a header line of
UserPrincipalName,CurrentPrimaryAddress,NewPrimaryAddress.
Change employees’ primary email addresses to the values in the NewPrimaryAddress column.
Retain employees’ current email addresses as secondary addresses.
You create the following Windows PowerShell script to read the .csv file. Line numbers are included for reference only.
You need to complete the script to meet the requirements.
Which Windows PowerShell command should you insert at line 06?

A.
Set-Mailbox -Identity $UserPrincipalName -EmailAddresses @{add=”SMTP:” + “$NewPrimary”;
remove=”SMTP:” + “$OldPrimary”}
B.
Set-Mailbox -Identity $UserPrincipalName -EmailAddresses @{add=”SMTP:” + “$NewPrimary”, “smtp:” +
“$OldPrimary”; remove=”SMTP:” + “$OldPrimary”}
C.
Set-Mailbox -Identity $UserPrincipalName -EmailAddresses @{add=”SMTP:” + “$NewPrimary”}
D.
Set-Mailbox -Identity $UserPrincipalName -PrimarySmtpAddress $NewPrimary
Explanation:
We add the new e-mail address. We retain the old email address by not removing it.
No, C is NOT correct. When running that command, you’ll get following error:
There are multiple primary SMTP addresses. Please ensure there is only one primary address for each address type.
Correct answer is B. I tested this in a trial tenant and B works.
D is also not correct, because -PrimarySmtpAddress is only valid in Exchange on-premise environment.
Set-Mailbox -Identity $UserPrincipalName -WindowsEmailAddress $NewPrimary will also work, since it changes the primary address, without removing other addresses.
5
0
Agree answer is B.
https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/add-recipientpermission?view=exchange-ps
SMTP: The primary SMTP address. You can use this value only once in a command.
smtp: Other SMTP email addresses.
To add or remove specify proxy addresses without affecting other existing values, use the following syntax: @{Add=”:”,”:”,…; Remove=”:”,”:”,…}.
3
0