SOLVED

Why the set-user does not show UserPrincipalName as an option?

Brass Contributor

Hi,

 

 

I tried to have the option UserPrincipalName when using the cmdlet Set-User by using tab but it is not appearing.

 

This is my script to connect to my exchange online

 

#######################################################
################### begin ##############################
#######################################################
# identification
#$credential = Get-Credential

$Username = 'andy.k@acme.com'
$Password = 'wu-kebab'
$pass = ConvertTo-SecureString -AsPlainText $Password -Force

$SecureString = $pass
$MySecureCreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username,$SecureString
$credential = $MySecureCreds


# once identified, connect to office365

Import-Module MsOnline
Connect-MsolService -Credential $credential

<# 
use the lines below to connect 
to exchange online
#>

$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection
Import-PSSession $exchangeSession -DisableNameChecking

#######################################################
################### end ########## #####################
#######################################################

When using the Identity option, things are fine.

Yet according to the doc , the option is available.

Am I missing something? Is it something related to the powershell version?

 

Please find below my version

PS C:\Users\KW> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14393  206

Any tips are more than welcomed.

Cheers

2 Replies
best response confirmed by Andy Kw (Brass Contributor)
Solution

Well, since you are already using the MSOnline module, the Set-MsolUserPrincipalName should be easier to get to.

1 best response

Accepted Solutions
best response confirmed by Andy Kw (Brass Contributor)
Solution

Well, since you are already using the MSOnline module, the Set-MsolUserPrincipalName should be easier to get to.

View solution in original post