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.
Incorrect:
Not A: We should keep the old address.
Not B: We should keep the old address.
Not D: This just change the PrimarySmtpAddress. We need to retain the old address.
Note: You can add a new email address to multiple mailboxes at one time by using the Shell and a
comma separated values (CSV) file.
This example imports data from C:\Users\Administrator\Desktop\AddEmailAddress.csv, which has
the following format.
Mailbox,NewEmailAddress
Dan Jump,[email protected]
David Pelton,[email protected]
Kim Akers,[email protected]
Janet Schorr,[email protected]
Jeffrey Zeng,[email protected]
Spencer Low,[email protected]
Toni Poe,[email protected]
…
Run the following command to use the data in the CSV file to add the email address to each mailbox
specified in the CSV file.
Import-CSV “C:\Users\Administrator\Desktop\AddEmailAddress.csv” | ForEach {Set-Mailbox
$_.Mailbox -EmailAddresses @{aAdd or remove email addresses for a mailbox
https://technet.microsoft.com/en-us/library/bb123794(v=exchg.160).aspx
Tested in lab>
C – Set-Mailbox -Identity $UserPrincipalName -EmailAddresses @{add=”SMTP:” + “$NewPrimary”} caused error:
There are multiple primary SMTP addresses. Please ensure there is only one primary address for each address type.
B – Set-Mailbox -Identity $UserPrincipalName -EmailAddresses @{add=”SMTP:” + “$NewPrimary”, “smtp:” + “$OldPrimary”; remove=”SMTP:” + “$OldPrimary”} partially worked. Error was caused by “+” (I didnt use variables), when used command
Set-Mailbox -Identity [email protected] -EmailAddresses @{add=”SMTP:[email protected]”, “smtp:[email protected]”; remove=”SMTP:[email protected]”} its was perfect.
Also, SMTP means primary address and must be used only once, smtp means other smtp address, so add new SMTP, add new smtp and remove old SMTP is correct process.
Correct answer is B
Agree with Anna. Tested as well.
Done this quite a lot in practice. Definitely B.
B
http://exchangeserverpro.com/manually-configuring-email-addresses-for-exchange-server-2013-recipients-using-powershell/ Set-Mailbox and provide the entire set of email addresses that we want to exist on the mailbox, using the case-sensitive prefix “SMTP” to specifiy which one is the primary address.