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.
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 @{a
Add or remove email addresses for a mailbox
https://technet.microsoft.com/en-us/library/bb123794(v=exchg.160).aspx



Leave a Reply 3

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


Test User

Test User

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.

ExtendedForhead

ExtendedForhead

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”}

ExtendedForhead

ExtendedForhead

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

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