還原已刪除的 OneDriveRestore a deleted OneDrive

當您在 Microsoft 365 admin center 中刪除使用者 (,或透過 Active Directory 同步處理) 移除使用者時,使用者的 OneDrive 會保留在 OneDrive 系統管理中心中指定的天數。When you delete a user in the Microsoft 365 admin center (or when a user is removed through Active Directory synchronization), the user's OneDrive will be retained for the number of days you specify in the OneDrive admin center. (如需詳細資訊,請參閱 設定已刪除 OneDrive 使用者的預設檔保留。 ) 預設為30天。(For info, see Set the default file retention for deleted OneDrive users.) The default is 30 days. 在這段時間內,其他使用者仍可存取共用內容。During this time, shared content can still be accessed by other users. 在時間結束時,OneDrive 會處於已刪除狀態的93天,且只能由全域或 SharePoint 系統管理員還原。At the end of the time, the OneDrive will be in a deleted state for 93 days and can only be restored by a global or SharePoint admin.

如需使用檔案還原將 OneDrive 還原至上一個時間點的詳細資訊,請參閱 Restore a OneDriveFor info about using Files Restore to restore a OneDrive to a previous point in time, see Restore your OneDrive.

如需從 OneDrive 還原回收站中之專案的詳細資訊,請參閱 還原已刪除的檔案或資料夾For info about restoring items from the recycle bin in OneDrive, see Restore deleted files or folders.

當刪除的使用者不再出現在 Microsoft 365 系統管理中心時,還原已刪除的 OneDriveRestore a deleted OneDrive when the deleted user no longer appears in the Microsoft 365 admin center

如果使用者已于30天內刪除,您可以從 Microsoft 365 系統管理中心還原使用者及其所有資料。If the user was deleted within 30 days, you can restore the user and all their data from the Microsoft 365 admin center. 若要深入瞭解,請參閱 Restore a user In Microsoft 365To learn how, see Restore a user in Microsoft 365. 如果您刪除的使用者超過30天,則使用者將不再出現在 Microsoft 365 系統管理中心,您必須使用 PowerShell 來還原 OneDrive。If you deleted the user more than 30 days ago, the user will no longer appear in the Microsoft 365 admin center, and you'll need to use PowerShell to restore the OneDrive.

  1. 下載最新的 SharePoint Online 管理命令介面Download the latest SharePoint Online Management Shell.

    注意

    如果您安裝的是舊版 SharePoint Online 管理命令介面,請移至 [新增或移除程式],並解除安裝 [SharePoint Online 管理命令介面]。If you installed a previous version of the SharePoint Online Management Shell, go to Add or remove programs and uninstall "SharePoint Online Management Shell."
    在下載中心頁面上,選擇您的語言,然後按一下 [下載] 按鈕。On the Download Center page, select your language and then click the Download button. 系統會請您選擇下載 x64 或 x86 .msi 檔案。You'll be asked to choose between downloading a x64 and x86 .msi file. 如果您執行的是 64 位元版本的 Windows,請下載 x64 檔案;或如果您執行的是 32 位元版本,請下載 x86 檔案。Download the x64 file if you're running the 64-bit version of Windows or the x86 file if you're running the 32-bit version. 如果您不知道,請參閱我正在執行哪個版本的 Windows 作業系統?If you don't know, see Which version of Windows operating system am I running?. 下載檔案之後,請執行檔案,並按照安裝精靈中的步驟進行。After the file downloads, run it and follow the steps in the Setup Wizard.

  2. 在 Microsoft 365 以全域系統管理員或 SharePoint 管理員的身分登入。Connect to SharePoint as a global admin or SharePoint admin in Microsoft 365. 若要了解如何進行,請參閱開始使用 SharePoint Online 管理命令介面To learn how, see Getting started with SharePoint Online Management Shell.

  3. 判斷 OneDrive 是否可用於還原Determine if the OneDrive is available for restore

  • 如果您知道 OneDrive 的 URL,請執行下列命令:If you know the URL of the OneDrive, run the following command:
Get-SPODeletedSite -Identity <URL>

使用者的 OneDrive URL 是以使用者的使用者名稱為基礎。A user's OneDrive URL is based on their username. 例如,https://microsoft-my.sharepoint.com/personal/user1_contoso_com。For example, https://microsoft-my.sharepoint.com/personal/user1_contoso_com. 您可以在 Microsoft 365 系統管理中心的 [作用中使用者] (或「刪除的使用者」) 頁面上找到其使用者名稱。You can find their username on the Active users (or Deleted users) page in the Microsoft 365 admin center.

  • 如果您不知道已刪除之 OneDrive 的 URL,請執行下列命令:If you don't know the URL of the deleted OneDrive, run the following command:
Get-SPODeletedSite -IncludeOnlyPersonalSite | FT url
  • 如果結果中出現 OneDrive,可將其還原。If the OneDrive appears in the results, it can be restored.
  1. 將 OneDrive 還原成使用中狀態:Restore the OneDrive to an active state:
Restore-SPODeletedSite -Identity <URL>
  1. 將管理員指派給 OneDrive,以存取必要的資料:Assign an administrator to the OneDrive to access the needed data:
Set-SPOUser -Site <URL> -LoginName <UPNofDesiredAdmin> -IsSiteCollectionAdmin $True

如需這些 Cmdlet 的詳細資訊,請參閱 Get-SPODeletedSite還原-SPODeletedSiteFor more info about these cmdlets, see Get-SPODeletedSite and Restore-SPODeletedSite.

永久刪除 OneDrivePermanently delete a OneDrive

從 OneDrive 復原您需要的資料之後,建議您執行下列命令,永久刪除 OneDrive:After you recover the data you need from the OneDrive, we recommend that you permanently delete the OneDrive by running the following command:

Remove-SPOSite -Identity <URL>
Remove-SPODeletedSite -Identity <URL>

警告

當您永久刪除 OneDrive 時,您將無法還原該。When you permanently delete a OneDrive, you will not be able to restore it.

請參閱See also

OneDrive 保留與刪除OneDrive retention and deletion