PrepAway - Latest Free Exam Questions & Answers

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?

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

3 Comments on “Which Windows PowerShell command should you insert at l…

  1. Test User says:

    I have tested all… It is not possible to add new Primary (SMTP:)
    So, Primary (SMTP:) must be removed first before added New Primary and add Old as Secondary (smtp:).
    And correct answer will be
    Set-Mailbox -Identity $UserPrincipalName -EmailAddresses @{remove=”SMTP:” + “$OldPrimary”; add=”SMTP:” + “$NewPrimary”, “smtp:” + “$OldPrimary”}

    Most closely is B, but operation remove must be first.




    0



    0
  2. ExtendedForhead says:

    All the answers are wrong. The syntax of ‘C’ in incorrect. For this to work it should be:

    Set-Mailbox -Identity $UserPrincipalName -EmailAddresses @{add=”SMTP:”$NewPrimary”,”$OldPrimary”}




    0



    0
  3. ExtendedForhead says:

    Oops sorry too many quotes! Removed quote after ‘SMTP:’.

    Set-Mailbox -Identity $UserPrincipalName -EmailAddresses @{add=”SMTP:$NewPrimary”,”$OldPrimary”}




    1



    0

Leave a Reply