Onedrive regional settings

Anonymous
2021-12-08T20:37:12.967+00:00

Hello

Does anyone know of any way to change the regional settings and timezone of a 365 user in onedrive using powershell. When creating new users we seem to have to change this as by default it is set up as US and have to change it to UK, UTC time for each user that we create. I am just wondering if there is any way to alter this using a powershell script as this would make it a lot easier than having to wait for the user to login.

156065-image.png

Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft 365 and Office | OneDrive | For business | Windows

2 answers

Sort by: Most helpful
  1. Echo Du_MSFT 17,351 Reputation points
    2021-12-09T08:43:07.73+00:00

    Hi @Anonymous ,

    Welcome to Q&A Forum!

    Please run the below PowerShell script as an admin on the SharePoint Online Management Shell:

    #Set Config Variables  
    $SiteURL = "https://domian-my.sharepoint.com/personal/username_domain_onmicrosoft_com/"  
    $TimezoneName = "(UTC-08:00) Pacific Time (US and Canada)"  
    #English  en-US   1033  
    $LocaleId = "1033"  
    
    #Connect to SharePoint Online with PnP PowerShell  
    #Enter the user account and password corresponding to the Onedrive page  
    Connect-PnPOnline $SiteURL -Credentials (Get-Credential)  
       
    #Get the Web  
    $web = Get-PnPWeb -Includes RegionalSettings.TimeZones  
       
    #Get the time zone  
    $Timezone  = $Web.RegionalSettings.TimeZones | Where {$_.Description -eq $TimezoneName}  
       
    If($Timezone -ne $Null)  
    {  
        #Update time zone of the site  
        $Web.RegionalSettings.TimeZone = $Timezone  
        $Web.RegionalSettings.LocaleId = $LocaleId  
        $Web.Update()  
        Invoke-PnPQuery  
        Write-host "Timezone Updated Successfully!" -ForegroundColor Green  
    }  
    else  
    {  
        Write-host "Timezone $TimezoneName not found!" -ForegroundColor Yellow  
    }  
    

    Here is my test:

    156155-o1.jpg

    156195-o2.jpg

    156163-o3.jpg

    Reference:

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.

    Thanks,
    Echo Du

    ====================================

    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.

    Was this answer helpful?

    2 people found this answer helpful.

  2. Vasil Michev 128.3K Reputation points MVP Volunteer Moderator
    2021-12-09T08:13:14+00:00

    You can use CSOM/PnP for that. This article has an example (just connect to the relevant ODFB site instead): https://www.pkbullock.com/blog/2020/the-many-ways-to-set-uk-locale-in-sharepoint/

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.