Permission & Access Issues

Fix Access Denied When Changing OneDrive Locale via PowerShell

Khadija KhanKhadija Khan Nov 2, 2026 868 views

Question details

The user needs to resolve an Access Denied error when running a PowerShell script to change the OneDrive for Business locale for all users.

Fix Access Denied When Changing OneDrive Locale via PowerShell
Product
OneDrive for Business
Device & OS
not provided
Scenario
An IT administrator is attempting to bulk update the regional settings (locale) for all employee OneDrive accounts using a PowerShell script but encounters access and execution failures.
Observed behavior
The PowerShell script returns an Access Denied error or halts entirely, failing to apply the locale change to the remaining users' OneDrive sites.
Before you start

Ensure you have SharePoint Administrator or Global Administrator privileges in your Microsoft 365 tenant before executing tenant-wide PowerShell scripts.

Solution 1Recommended

Resolve Provisioning and Administrator Permissions

Ensure all users have active OneDrive sites and the executing admin has correct permissions to avoid Access Denied errors.

A loop-based PowerShell script will often halt and fail to update remaining users if it encounters a single user whose OneDrive has not been fully provisioned or where permissions are restricted.

1
Check user provisioning

Ensure that every targeted user has signed in and accessed their OneDrive for Business at least once. This initial access triggers the actual site provisioning process in SharePoint.

2
Grant administrator permissions

Configure your script or tenant settings to add your administrator account as a secondary site collection administrator for each user's individual OneDrive site before executing the locale update.

Resolve Provisioning and Administrator Permissions
Script Halting: To prevent the entire script from failing due to one unprovisioned user, consider adding error handling (Try/Catch) blocks in your PowerShell script to log the error and continue to the next user.
Free Microsoft Office alternative

Simplify Your Document Workflow with WPS Office

Managing enterprise Microsoft 365 environments and running complex PowerShell scripts can be time-consuming. Equip your team with WPS Office, a highly compatible, lightweight, and cost-effective alternative for everyday document editing and collaboration.

  1. 1. Download WPS Office: Visit the official WPS website to download the free installer for your operating system.
  2. 2. Install the application: Run the lightweight installer and complete the setup process in just a few clicks.
  3. 3. Open your files: Instantly open your existing Microsoft Office files and start working with zero learning curve.
Seamlessly open, edit, and save Microsoft Word, Excel, and PowerPoint files without formatting loss.Avoid complex IT administration tasks with a straightforward, user-friendly interface.Lightweight application design ensures fast installation and smooth operation on any device.Free to use with built-in PDF tools for a comprehensive office suite experience.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PowerShell script stop updating users halfway through?

Loop-based PowerShell scripts will often fail and halt if they encounter a user whose OneDrive has not been provisioned yet or if the admin account executing the script lacks Site Collection Administrator permissions for that specific user's site.

Does changing the OneDrive locale change the user's Microsoft 365 account region?

No, updating the locale via this specific PowerShell script only modifies the regional settings for the user's OneDrive for Business site. The main Microsoft 365 user account's regional settings remain separate and must be modified in the Microsoft 365 admin center or Azure AD.

How can users manually check their OneDrive locale?

Users can check their locale by opening OneDrive on the web, clicking Settings (gear icon) > OneDrive settings > More settings > Return to the old site settings pages, and finally selecting Regional settings to view the Locale.