Add a site language using powershell Pnponline or SPOService

Andy McRae 1 Reputation point

I create users via a ps command like this

New-MsolUser -UserPrincipalName $user.Email -Password $user.Password [...] -PreferredLanguage fr-FR

Knowing that the tenant is in German (de-DE) all the web apps are in german (See image)


So i need to connect to the sharepoint site to be able to add french like this


But I need to do it with powershell because I make a lot of accounts daily with the script.

So I followed a "how to do" where it is given the ps commands like this:

Install-Module -Name Microsoft.Online.SharePoint.PowerShell -SkipPublisherCheck -Force
$user = ""
$password = ConvertTo-SecureString 'a_secret_password_here' -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential ($user,$password)
Connect-PnPOnline -Url "" -Credentials $creds
$Web = Get-PnPWeb
$Web.AddSupportedUILanguage(1036) (French)

but the problem is that this only works if the user has logged in once manually on the sharepoint site, where all of a sudden it kind of creates the user sharepoint url "
It thicks the FR button like here
Otherwise i get the 404 not found error like this
232483-errors-404.png 2: /api/attachments/232444-de-fr.png?platform=QnA

A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,600 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,359 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 30,991 Reputation points Microsoft Vendor

    Hi @Andy McRae
    Connect-PnPOnline site url should be like following  

    In your case, The site url should be  


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.