Which Windows PowerShell command should you insert at l…

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?

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.



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Ray

Ray

I think B is right.

judy

judy

I think B is right too.
The fact of adding SMTP new address will not change the old SMTP attribute.
The SMTP address is the principal and the smtp address the secondary.
I think the old SMTP address must be removed

PeterDo

PeterDo

The given answer C is not correct because it would result in the error below:
There are multiple SMTP addresses. Please ensure there is only one primary address for each address type.

A: wrong because it would add the new SMTP address but also remove the old email address

B is correct (the logic is correct: add new SMTP, add the old email address as smtp, remove the old SMPT) except its syntax needs to be corrected as follows:
Set-Mailbox -Identity $UserPrincipalName -EmailAddresses @{add=”SMTP:$NewPrimary”, “smtp:$OldPrimary”; remove=”SMTP:” + “$OldPrimary”}