EASYENTRA Blog

News & Updates

How to Restrict OneDrive Access to Read-Only or No-Access Mode

How to Restrict OneDrive Access to Read-Only or No-Access Mode

When an employee leaves the organization, goes on extended leave, or becomes the subject of an internal investigation, securing their business data becomes a priority. OneDrive for Business often contains important corporate documents, making it essential for administrators to quickly control access when required.

Instead of deleting files or removing the OneDrive entirely, Microsoft 365 allows administrators to change the site’s lock state. You can make the OneDrive read-only so files can still be viewed but not modified, completely block access to the site, or restore normal access when the restriction is no longer needed.

In this guide, we will walk you through two efficient ways to change a user’s OneDrive lock state.  

What are OneDrive Lock States

Since OneDrive for Business is built on SharePoint Online, every user’s OneDrive is actually a personal SharePoint site collection. SharePoint allows administrators to configure three different lock states for these sites:

  • Unlock restores normal read and write access to the OneDrive.
  • ReadOnly allows users to open and download existing files but prevents uploading, editing, renaming, or deleting content.
  • NoAccess blocks access to the entire OneDrive site. Users attempting to access the site will receive an access denied error until the site is unlocked again.

These lock states are particularly useful during employee offboarding, temporary leave, investigations, or whenever corporate data needs to be protected without deleting it.

1. Restrict OneDrive Access via PowerShell

Because OneDrive sites are SharePoint Online site collections, administrators can manage their lock state using the SharePoint Online Management Shell.

Prerequisites: Before running the commands, ensure you have downloaded and installed the latest SharePoint Online Management Shell. Once installed, open PowerShell and establish an administrative connection.

Set OneDrive to Read-Only Mode

This mode blocks users from uploading, editing, or deleting files, but allows them to view and download existing content.

#Lock the specific user's OneDrive to Read-Only 
Set-SPOSite -Identity "<SiteURL>" -LockState "ReadOnly" 

Set OneDrive to No-Access Mode

This completely blocks the user from reaching the OneDrive site, throwing a 403 Forbidden error if they attempt to access it.

#Completely block access to the specific user's OneDrive 
Set-SPOSite -Identity "<SiteURL>" -LockState "NoAccess"

Revert OneDrive to Normal Access

If the restriction was temporary (such as a medical leave), you can easily restore standard read and write capabilities by unlocking the site.

#Unlock the site to restore standard access
Set-SPOSite -Identity "<SiteURL>" -LockState "Unlock"

Note: Don’t forget to replace <SiteURL> with the values for your own Microsoft 365 tenant.

How to Find a User’s OneDrive URL

If you do not know the precise personal URL format for the target user, get a comprehensive list of all active user OneDrive sites and their current lock statuses across your tenant.

#List all user OneDrive locations 
Get-SPOSite -IncludePersonalSite $true -Limit All | Select-Object Url, LockState 

2. Restrict OneDrive Access via EasyEntra

If you prefer avoiding complex command-line scripts or want a faster administrative workflow, you can easily control a user’s OneDrive site lock state directly inside the EasyEntra portal.

Locking a OneDrive site through the UI helps protect data during investigations, employee offboarding, leaves of absence, or other situations where access needs to be restricted temporarily or permanently.

To configure the lock state for OneDrive in EasyEntra, follow these simple steps:

  1. Open User Properties for the target user.
  2. Select the OneDrive tab.
  3. In the Lock state dropdown list, select your desired lock state configuration (Unlock, ReadOnly, or NoAccess).
  4. Click OK to apply the settings instantly.

With EasyEntra, there is no need to manually retrieve the user’s OneDrive URL or remember SharePoint PowerShell syntax. Everything can be managed directly from the user’s properties, making the process faster and reducing the chance of administrative errors!

Free 30-minute demo

try 30 days for free

GET EASYENTRA NEWS

Opt out at any time

“One of the best products I've used.”
Gary Shurland
Chief Information Officer, Mirick, United States
“This tool has been invaluable in streamlining our IT processes.”
Tyson Mckay
Chief Information Officer, Southwest Network, United States
“This product has been a miracle for our Help Desk. EasyEntra has completely transformed how we handle Microsoft 365 administration.”
Doug Sanders
Manager of Technical Customer Support, Junior Achievement USA, United States
“Your product is such a time saver. I love it!”
Scott Fehr
IT Infrastructure, MEC Aerial Work Platforms, United States
“It's a good product and saves us lots of time for these ongoing quick admin tasks.” 
Chris McFerran
Managing Director, CTech IT Solutions Ltd, United Kingdom
“EasyEntra has significantly streamlined our workflow, simplifying everything. It feels almost like a revolution.”
Johan Sadelius
IT-chef, Arjeplog Kommun, Sweden
I greatly appreciate your assistance and willingness to enhance the already outstanding product.”
Michael I. Wilson
Executive Director of Information Technology, Archdiocese Of Washington, United States
“It's great not having to switch back and forth between the O365 admin center and the Teams admin center to assign groups. I am sold!”
Thomas Madden
Director Information Technology, AutoPayPlus, United States
“I would highly recommend organizations use the solution as it greatly simplifies various tasks.”
S. Roger Singh
Chief Technology Officer, Prasad & Company LLP, Canada
“EasyEntra is time-saving. Love the copy/paste for user/computer groups and the copy to new user.”
Damian Nita
Associate Network Administrator, Shenandoah Valley Westminster-Canterbury, United States
“EasyEntra has transformed our daily IT operations by simplifying user management, reducing errors, and enhancing overall efficiency.”
Henrik Nefling
IT- and Digitalization Manager, Animal Protection Denmark, Denmark