PrepAway - Latest Free Exam Questions & Answers

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?

PrepAway - Latest Free Exam Questions & Answers

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,danj@northamerica.contoso.com
David Pelton,davidp@northamerica.contoso.com
Kim Akers,kima@northamerica.contoso.com
Janet Schorr,janets@northamerica.contoso.com
Jeffrey Zeng,jeffreyz@northamerica.contoso.com
Spencer Low,spencerl@northamerica.contoso.com
Toni Poe,tonip@northamerica.contoso.com

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 @{a

Add or remove email addresses for a mailbox

https://technet.microsoft.com/en-us/library/bb123794(v=exchg.160).aspx

5 Comments on “Which Windows PowerShell command should you insert at line 06?

  1. Anna says:

    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 user@contoso.com -EmailAddresses @{add=”SMTP:new@contoso.com”, “smtp:user@contoso.com”; remove=”SMTP:user@contoso.com”} 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




    0



    0

Leave a Reply