Home > OneDrive Migration Process > Migration Execution > 6. Set the source site to read only

    Export to PDF

    6. Set the source site to read only

    Before executing the final delta/incremental migration, make sure that no data will be changed or created in the source during the migration to enforce the data consistency.

    - To set OneDrive as read only, run the following script using PowerShell:

    #Set Parameters

    $AdminCenterURL="https://contoso-admin.sharepoint.com"

    $SiteURL = "https://contoso-my.sharepoint.com/personal/admin_contoso_onmicrosoft_com"

    #Connect to SharePoint Online

    Connect-SPOService -Url $AdminCenterURL -Credential (Get-Credential)

    #PowerShell to set onedrive for business site to read only

    Set-SPOSite -Identity $SiteURL -LockState ReadOnly

    - To unlock the OneDrive, run the following script using PowerShell:

    #Unlock site from read only mode

    Set-SPOSite -Identity $SiteURL -LockState Unlock