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 -WindowsEmailAddress $NewPrimary
B.
Set-Mailbox -Identity $UserPrincipalName -PrimarySmtpAddress $NewPrimary
C.
Set-Mailbox -Identity $UserPrincipalName -ExternalEmailAddress $NewPrimary
D.
Set-MailUser -Identity $UserPrincipalName -EmailAddresses@{add = “SMTP:” + “$NewPrimary”; remove=”SMTP:” + “$OldPrimary”}
Not correct for me.
Right Answer A
Could you precise Freerider, is it because the old primary will stay and become the secondary email address by default ?
yes, Right Answer A
The correct answer isn’t shown they are all wrong. The correct answer is:
Set-MailUser -Identity $UserPrincipalName -EmailAddresses@{add = “SMTP:” + “$NewPrimary”; add = “smtp:” +“$OldPrimary”}
See: https://technet.microsoft.com/en-us/library/bb123794(v=exchg.160).aspx
Set-Mailbox -Identity $UserPrincipalName -EmailAddresses @{add=”SMTP:$NewPrimary”,”$OldPrimary”}
This works in theory except if you have a situation where the users has more then the 2 addresses (old and new) as it would wipe the remaining email alias addresses.
see remove an email address below:
https://technet.microsoft.com/en-us/library/bb123794(v=exchg.160).aspx
still not sure on the correct answer
The provided answers are incomplete, the following answers are the the correct ones:
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
Sorry, answer “C” full cmdlet is:
Set-MailUser -Identity $UserPrincipalName -EmailAddresses@{add = “SMTP:” + “$NewPrimary”; add = “smtp:” +“$OldPrimary”}