Script to Write and Get of User Profile properties in SharePoint Online via PowerShell with CSOM. Spports Single and Multi valued properties!
In Order to use this script you will need SharePoint Server 2013 Client Components SDK or SharePoint Online Client Components SDK that was released September 2014 or newer!!!
You will need proper Admin permissions in SharePoint Online tenant in order connect SPO Admin portal and alter the user profiles.  

The script can edit Single and Multi value properties. You should provide the multivalued property values as string list or just as comma separated strings for the Value parameter.
  
The script is not tested with all properties, some of the properties have specific requirements for the input for example the dates!
If the format of your property value is not correct a meaningful error from CSOM can be expected. Test the script with single user.
If the result meets your expectation you can use this script for editing multiple user profiles.
  
The script can be combined with values from CSV file,simple text list with user logins or anything you can find for useful.
You can edit it as well as you find for useful in your case.

Author: Ivan Yankulov
Contact:  http://spyankulov.blogspot.com
About this script:  http://spyankulov.blogspot.com/2015/05/write-and-get-user-profile-properties-the-scripts.html
How it works: http://spyankulov.blogspot.com/2014/12/write-and-get-user-profile-properties.html

.EXAMPLE
   .\Set-SPOUserProfileProperty.ps1 -PropertyName WorkPhone -AccountName bonniek@contoso.onmicrosoft.com -Value "+44 555 555 55" -SPOAdminPortalUrl https://contoso-admin.sharepoint.com -UserName admin@contoso.onmicrosoft.com -Password Pa$$w0rd
  
     Description
     -----------
     This will set new Work Phone for account bonniek@contoso.onmicrosoft.com to value +44 555 555 555
.EXAMPLE
   .\Set-SPOUserProfileProperty.ps1 -PropertyName SPS-Skills -AccountName bonniek@contoso.onmicrosoft.com -Value "SharePoint","PowerShell","Tech Support" -SPOAdminPortalUrl https://contoso-admin.sharepoint.com -UserName admin@contoso.onmicrosoft.com -Password Pa$$w0rd -MultiValue
     
     Description
     -----------
     This will set values for MultiValue property SPS-Skills (Skills) for user bonniek@contoso.onmicrosoft.com
.EXAMPLE
   .\Set-SPOUserProfileProperty.ps1 -PropertyName SPS-MUILanguages -AccountName  pavelb@contoso.onmicrosoft.com,bonniek@contoso.onmicrosoft.com -Value "bg-BG,en-US,de-DE" -SPOAdminPortalUrl https://contoso-admin.sharepoint.com -UserName admin@contoso.onmicrosoft.com -Password Pa$$w0rd
     
     Description
     -----------
     This will set values for Single Value property SPS-MUILanguages (Display Language) for user accounts pavelb@contoso.onmicrosoft.com,bonniek@contoso.onmicrosoft.com , 1.Bulgarian(bg-BG),2. English US(en-US) and 3.German(de-DE)


For more information see: Get-Help .\Set-SPOUserProfileProperty.ps1 -Full


Test, use Q&A, Rate!

 

 

 

PowerShell
Edit|Remove
#########################################################################        
#                         Sample     
#              Full Code is in the File        
######################################################################### 
    $securePassword = ConvertTo-SecureString $Password -AsPlainText -Force 
    $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName$securePassword) 
    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SPOAdminPortalUrl) 
    $ctx.Credentials = $credentials 
 
    $peopleManager = New-Object Microsoft.SharePoint.Client.UserProfiles.PeopleManager($ctx) 
} 
PROCESS{ 
    SWITCH ($PsCmdlet.ParameterSetName){ 
 
        "SingleValue"{ 
            ForEach ($targetAcc in $AccountName){ 
                Write-Host "Updating User Profile Property `"$PropertyName`" for account - `"$targetAcc`"" -ForegroundColor Green 
                $targetAccount = ("i:0#.f|membership|" + $targetAcc) 
                $peopleManager.SetSingleValueProfileProperty($targetAccount$PropertyName$Value) 
                $ctx.ExecuteQuery() 
            } 
        } 
        "MultiValue"{ 
            ForEach ($targetAcc in $AccountName){ 
                Write-Host "Updating User Profile Property `"$PropertyName`" for account - `"$targetAcc`"" -ForegroundColor Green 
                $targetAccount = ("i:0#.f|membership|" + $targetAcc) 
                $peopleManager.SetMultiValuedProfileProperty($targetAccount$PropertyName$Value) 
                $ctx.ExecuteQuery() 
            } 
        } 
 
    }  
 
}