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

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

  1. M P says:

    With explanation
    A: Parameter -WindowsEmailAddress “[..]the WindowsEmailAddress parameter updates the WindowsEmailAddress property and the primary email address to the same value.”

    B: Parameter -PrimarySmtpAddress is only on-premises

    C: Parameter -ExternalEmailAddress is bogus for Set-Mailbox.

    D: Syntax – Set-mailuser cmdlet is for “mail users” hence:no exchange mailboxes, “add” and “remove” is used for that not replacing.

    So A is missing something to be correct as a part of the solution is:
    “Retain employees’ current email addresses as secondary addresses.”




    0



    0
  2. Marty McFly says:

    A is right

    Here is a mailbox with multiple addresses in the EmailAddresses attribute, the default is the one with SMTP in front

    Get-Mailbox biggyd | select DisplayName,*address*

    DisplayName : David ****
    AddressBookPolicy :
    ForwardingAddress :
    ForwardingSmtpAddress :
    OfflineAddressBook :
    JournalArchiveAddress :
    GeneratedOfflineAddressBooks : {}
    AddressListMembership : {\Mailboxes(VLV), \All Mailboxes(VLV), \All
    Recipients(VLV), \All Users…}
    EmailAddresses : {SIP:BiggyD@***.onmicrosoft.com,SMTP:Big
    gyD@******.onmicrosoft.com,smtp:DavidL@****
    *****.onmicrosoft.com,
    SMTP:BiggyD@******.onmicrosoft.com}
    HiddenFromAddressListsEnabled : False
    EmailAddressPolicyEnabled : False
    PrimarySmtpAddress : BiggyD@******.onmicrosoft.com
    WindowsEmailAddress : BiggyD@******.onmicrosoft.com

    I then use the command in A

    set-Mailbox -identity biggyd -WindowsEmailAddress DavidL@******.onmicrosoft.com

    and check again and the default is now changed, hence the former primary/default becomes secondary (hopefully the SIP address will change in due course…)

    Get-Mailbox biggyd | select DisplayName,*address*

    DisplayName : David ******
    AddressBookPolicy :
    ForwardingAddress :
    ForwardingSmtpAddress :
    OfflineAddressBook :
    JournalArchiveAddress :
    GeneratedOfflineAddressBooks : {}
    AddressListMembership : {\Mailboxes(VLV), \All Mailboxes(VLV), \All
    Recipients(VLV), \All Users…}
    EmailAddresses : {smtp:BiggyD@******.onmicrosoft.com,
    SMTP:DavidL@******.onmicrosoft.com, SIP:Big
    gyD@******.onmicrosoft.com,SMTP:BiggyD@***.onmicrosoft.com,smtp:DavidL@******.o
    nmicrosoft.com}
    HiddenFromAddressListsEnabled : False
    EmailAddressPolicyEnabled : False
    PrimarySmtpAddress : DavidL@******.onmicrosoft.com
    WindowsEmailAddress : DavidL@******.onmicrosoft.com

    I thank you




    2



    0
  3. Anna says:

    I wasnt sure about D beeig incorrect.
    1) Remove SMTP is right, type:SMTP is valid only for primary address

    SMTP The primary SMTP address. You can use this value only once in a command.
    smtp Other SMTP email addresses.

    Valid syntax for this parameter is :,:…. The optional value specifies the type of email address.
    If you don’t include a value for an email address, the value smtp is assumed.

    2) in the question is not specified if its about Mailboxes or MailUsers, can be both

    Practical test:
    Create MailUser with primary SMTP mailusertest@gmail.com and external smtp same. Run command :
    Set-MailUser -Identity mailusertest@contoso.com -EmailAddresses @{add = “SMTP:” + “mailusertestnew@gmail.com”; remove=”SMTP:” + “mailusertest@gmail.com”}

    result: primary address is changed, external smtp stayed same, original primary didnt appear as secondary

    Create Mailbox test@contoso.com. Run command:
    Set-Mailbox -Identity test@contoso.com -WindowsEmailAddress newtest@contoso.com

    result: primary address is changed, original primary address is secondary now

    Answer A is correct.

    If you are interested.. :
    VERBOSE: [13:34:47.295 GMT] Set-Mailbox : The properties changed on the object ‘test’ (CN=test,OU=Contoso.com users,DC=Contoso,DC=com) are: “{ EmailAddresses[proxyAddresses]={ ‘X500:/o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=a72eda5307c148c4848bc8fc48e16cde-test’, ‘smtp:test@Contoso.com’, ‘smtp:test@Contoso.mail.onmicrosoft.com’, ‘SMTP:newtest@Contoso.com’ }, UMDtmfMap[msExchUMDtmfMap]={ ‘firstNameLastName:8378’, ‘lastNameFirstName:8378′, ’emailAddress:6398378′ },
    WindowsEmailAddress[mail]=’newtest@Contoso.com’, Extensions[proxyAddresses]={ }, PrimarySmtpAddress[proxyAddresses]=’newtest@Contoso.com’, IndexedPhoneNumbers[msExchUMDtmfMap]={ }, OriginalPrimarySmtpAddress[]=’newtest@Contoso.com’, OriginalWindowsEmailAddress[]=’newtest@Contoso.com’ }”.




    0



    0
  4. Nathan Guidry says:

    The answer is D, however they have it written wrong here.

    D is actually:
    D.
    Set-MailUser -Identity $UserPrincipalName -EmailAddresses@{add = “SMTP:” + “$NewPrimary”; add = “smtp:” + “$OldPrimary”; remove=”SMTP:” + “$OldPrimary”}




    0



    0
  5. Massimo says:

    A is correct, changing the WindowsEmailAddress property updates the *primary* email address, while retaining other existing ones.
    B and C use a wrong syntax.
    D probably uses a wrong syntax too (can’t check it now), but even if it worked, it would remove the old address, violating the requirements.




    0



    0

Leave a Reply