获取组织中所有用户 OneDrive URL 的列表Get a list of all user OneDrive URLs in your organization

本文适用于 Microsoft 365 中的全局管理员和 SharePoint 管理员。This article is for global and SharePoint admins in Microsoft 365.

查看组织中 OneDrive 用户和 URL 的列表View the list of OneDrive users and URLs in your organization

  1. 以全局管理员或 SharePoint 管理员角色登录。 (如果看到一条消息,表明你无权访问该页面,则表明你组织中 https://admin.microsoft.com 没有 Microsoft 365 管理员权限。) Sign in to https://admin.microsoft.com as a global or SharePoint admin. (If you see a message that you don't have permission to access the page, you don't have Microsoft 365 admin permissions in your organization.)

    备注

    如果你使用的是 Office 365 Germany,请在 https://portal.office.de 登录。如果使用的是由世纪互联运营的 Office 365(中国),请在 https://login.partner.microsoftonline.cn/ 登录。然后选择“管理员”磁贴打开管理中心。If you have Office 365 Germany, sign in at https://portal.office.de. If you have Office 365 operated by 21Vianet (China), sign in at https://login.partner.microsoftonline.cn/. Then select the Admin tile to open the admin center.

  2. 在左窗格中,选择"报告使用情况 > "。In the left pane, select Reports > Usage. (可能需要选择" 全部显示" 以查看"报告"选项。) (You might need to select Show all to see the Reports option.)

  3. 选择 OneDrive 文件 磁贴,或 选择"选择 > 报告 OneDrive 使用情况"。Select the OneDrive files tile, or select Select a report > OneDrive usage.

    备注

    如果在报告(而不是 URL 和名称)中看到 GUID,请在左窗格中选择"设置服务 > &外接程序",然后选择"报告 "。If you see GUIDs in the report instead of URLs and names, in the left pane, select Settings > Services & add-ins, and then select Reports. 清除" 显示匿名标识符,而不是所有报告中的名称"框Clear the box Display anonymous identifiers instead of names in all reports.

  4. 在表格右上方的底部,选择"导出 "。In the upper right of the table at the bottom, select Export.

使用 Microsoft PowerShell 创建组织中所有 OneDrive URL 的列表Create a list of all the OneDrive URLs in your organization using Microsoft PowerShell

在以下步骤中创建的列表将保存到文本文件中。The list you create in these steps will be saved to a text file.

  1. 下载最新的SharePoint在线管理壳Download the latest SharePoint Online Management Shell.

    备注

    如果你已安装早期版本的SharePoint Online Management Shell,请进入添加或删除程序并卸载 "SharePoint Online Management Shell"。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. 将以下文本保存到 PowerShell 文件。Save the following text to a PowerShell file. 例如,您可以将其保存到名为 OneDriveSites.ps1。For example, you could save it to a file named OneDriveSites.ps1.

    $TenantUrl = Read-Host "Enter the SharePoint admin center URL"
    $LogFile = [Environment]::GetFolderPath("Desktop") + "\OneDriveSites.log"
    Connect-SPOService -Url $TenantUrl
    Get-SPOSite -IncludePersonalSite $true -Limit all -Filter "Url -like '-my.sharepoint.com/personal/'" | Select -ExpandProperty Url | Out-File $LogFile -Force
    Write-Host "Done! File saved as $($LogFile)."
    
  3. 打开 SharePoint Online 命令行管理程序。Open the SharePoint Online Management Shell. 导航到保存并运行脚本的目录:Navigate to the directory where the script has been saved and run:

    PS C:\>.\OneDriveSites.ps1
    

    备注

    如果收到关于无法运行脚本的错误消息,则可能需要更改执行策略。If you get an error message about being unable to run scripts, you might need to change your execution policies. 请参阅此处有关执行策略的详细信息。For info, see About Execution Policies.

  4. 脚本将提示您输入 SharePoint 管理中心 URL。The script will prompt you for the SharePoint admin center URL. 例如, https://contoso-admin.sharepoint.com 是 Contoso SharePoint 管理中心 URL。For example, https://contoso-admin.sharepoint.com is the Contoso SharePoint admin center URL.

  5. 然后,系统将提示你登录。You will then be prompted to sign in. 使用 SharePoint 管理员或全局管理员帐户。Use a SharePoint admin or global admin account.

脚本成功完成后,将在脚本中的 $LogFile 变量指定的位置创建一个文本文件。After the script successfully completes, a text file is created in the location specified by the $LogFile variable in the script. 此文件包含组织中所有 OneDrive Url 的列表。This file contains a list of all OneDrive Urls in your organization. 以下文本提供了此文件中 URL 列表的格式设置示例。The following text provides an example of how the list of Urls in this file should be formatted.

https://contoso-my.sharepoint.com/personal/annb_contoso_onmicrosoft_com/ https://contoso-my.sharepoint.com/personal/carolt_contoso_onmicrosoft_com/ https://contoso-my.sharepoint.com/personal/esterv_contoso_onmicrosoft_com/ https://contoso-my.sharepoint.com/personal/hollyh_contoso_onmicrosoft_com/

更多信息More information

获取用户的 OneDrive 的 URL 后,可以使用 Get-SPOSite cmdlet 获取有关它的更多信息,然后使用 Set-SPOSite cmdlet 更改设置。Once you have the URL for a user's OneDrive, you can get more info about it by using the Get-SPOSite cmdlet, and change settings by using the Set-SPOSite cmdlet.