使用旧 cmdlet 配置 (级别的) Configure access at the user level (old cmdlets)

角色: Microsoft 365 管理员Role: Microsoft 365 admins

Note

本主题介绍 PowerShell cmdlets Get-UserAnalyticsConfigSet-UserAnalyticsConfig 的使用This topic describes the use of the PowerShell cmdlets Get-UserAnalyticsConfig and Set-UserAnalyticsConfig. 到 2021 年 1 月 25 日,这些 cmdlet 将停用,并分别替换为新的 cmdlet Get-MyAnalyticsFeatureConfigSet-MyAnalyticsFeatureConfig。By January 25, 2021, these cmdlets will be retired, and replaced by the new cmdlets Get-MyAnalyticsFeatureConfig and Set-MyAnalyticsFeatureConfig, respectively. 请务必更新工作流和脚本,以使用新 cmdlet (如该日期配置 MyAnalytics) 中所述。Please be sure to update your workflow and scripts to use the new cmdlets (as described in Configure MyAnalytics) by that date.

您可以为组织中单个用户配置 MyAnalytics 访问权限。You can configure MyAnalytics access for individual users in your organization. 例如,你可以完全选择退出用户,这将关闭该用户的所有 MyAnalytics 功能。For example, you could opt-out the user completely, which would turn off all MyAnalytics functionality for that user. 但是,用户可以选择 重新加入However, the user can choose to opt back in.

通过设置 PrivacyMode 参数配置 MyAnalytics。You configure MyAnalytics by setting the PrivacyMode parameter. 有关 PrivacyMode 的值的信息,请参阅 用户配置设置For information about the values of PrivacyMode, see User configuration settings.

用户配置设置User configuration settings

PrivacyMode 参数PrivacyMode parameter 许可用户Licensed user 未授权用户Unlicensed user
选择加入 (默认设置) Opt-in (default setting)
  • Microsoft 365 数据用于向许可用户显示的聚合信息Microsoft 365 data is used for aggregated information shown to licensed users
  • 仪表板可用Dashboard is available
  • 用户可以选择退出User can opt out
  • Microsoft 365 数据用于向许可用户显示的聚合信息Microsoft 365 data is used for aggregated information shown to licensed users
  • 管理员可以通过管理员 PowerShell 选择退出未授权用户Admins can opt out unlicensed users through the admin PowerShell
选择退出Opt-out
  • Microsoft 365 数据不用于向许可用户显示的聚合信息Microsoft 365 data is not used for aggregated information shown to licensed users
  • 仪表板不可用Dashboard is not available
  • 用户可以通过"功能设置"菜单选择加入User can opt in through the Feature settings menu
  • Microsoft 365 数据不用于向许可用户显示的聚合信息。Microsoft 365 data is not used for aggregated information shown to licensed users.

Important

PrivacyMode 的已排除值即将停用。The Excluded value of PrivacyMode is being retired. 以前设置为"已排除"的隐私模式的用户现在将设置为"选择退出"。Users whose privacy mode was previously set to Excluded will now be set to Opt-out.

为一个用户设置 MyAnalytics 访问权限Set MyAnalytics access for one user

使用以下 PowerShell cmdlet 为用户配置 MyAnalytics 访问设置:Configure MyAnalytics access settings for a user with the following PowerShell cmdlet:

Set-UserAnalyticsConfig –Identity <string> [PrivacyMode <string[]>]
参数Parameter 必需Required 说明Description 默认值Default value
标识Identity 是的。Yes 存储在 Azure Active Directory 中的当前用户的用户 ID (AAD) User ID for the current user as stored in Azure Active Directory (AAD) --
PrivacyModePrivacyMode 是的。Yes
  • 选择退出:MyAnalytics 不会使用用户数据来计算其他用户的派生统计信息。Opt-out: MyAnalytics won't use the user's data to compute derived statistics for other users. 用户在 MyAnalytics 中不会看到统计信息,但可以选择从功能设置菜单中选择加入。The user won't see statistics in MyAnalytics, but can choose to opt in from the Feature settings menu.
  • 选择加入:MyAnalytics 使用用户数据来计算其他用户的派生统计信息。Opt-in: MyAnalytics uses the user's data to compute derived statistics for other users. 用户可以在 MyAnalytics 中查看统计信息,但可以选择退出功能设置菜单。The user can see statistics in MyAnalytics, but can choose to opt out from the Feature settings menu.
选择加入Opt-in

Important

PrivacyMode 的已排除值即将停用。The Excluded value of PrivacyMode is being retired. 以前设置为"已排除"的隐私模式的用户现在将设置为"选择退出"。Users whose privacy mode was previously set to Excluded will now be set to Opt-out.

确认用户的 MyAnalytics 访问权限Confirm MyAnalytics access for a user

使用以下方法确认用户是否有权访问 MyAnalytics (PrivacyMode) :Use the following to confirm if a user has access to MyAnalytics (the value for PrivacyMode):

Get-UserAnalyticsConfig –Identity <string>
参数Parameter 必需Required 说明Description 默认值Default value
标识Identity 是的。Yes AAD 中存储的当前用户的用户 IDUser ID for the current user as stored in AAD -

为多个用户设置 MyAnalytics 访问权限Set MyAnalytics access for multiple users

使用 Exchange Online PowerShell V2 模块中的以下步骤更改对 MyAnalytics (PrivacyMode) 值的访问权限,具体方法为运行一个在用户间进行访问的 PowerShell 脚本,每次更改一个用户的值。Use the following steps in the Exchange Online PowerShell V2 module to change access to MyAnalytics (the value of PrivacyMode) for multiple users by running a PowerShell script that iterates through the users, changing the value one user at a time.

  1. 创建一个逗号分隔值 (.csv) 文本文件,其中包含要配置的用户的 UserPrincipalName 字段。Create a comma-separated value (.csv) text file that contains the UserPrincipalName field of the users you want to configure. 例如:For example:

    UserPrincipalName
    ClaudeL@contoso.onmicrosoft.com
    LynneB@contoso.onmicrosoft.com
    ShawnM@contoso.onmicrosoft.com
    
  2. 指定输入 .csv 文件的位置、输出 .csv 文件和要为每个用户设置的 PrivacyMode 的值:Specify the location of the input .csv file, the output .csv file, and the value of PrivacyMode that you want to set for each user:

    $inFileName="<path and file name of the input .csv file that contains the users, example: C:\admin\Users2License..csv>"
    $outFileName="<path and file name of the output .csv file that records the results, example: C:\admin\Users2License-Done..csv>"
    $privacyMode = "Opt-in"
    
    $users=Import-Csv $inFileName
    ForEach ($user in $users)
    {
    $user.Userprincipalname
    $upn=$user.UserPrincipalName
    
    Set-UserAnalyticsConfig –Identity $upn -PrivacyMode $privacyMode
    Get-UserAnalyticsConfig –Identity $upn | Export-Csv $outFileName
    }
    
  3. 在 Exchange Online PowerShell V2 模块命令提示符下运行生成的命令。Run the resulting commands at the Exchange Online PowerShell V2 module command prompt. 有关模块详细信息,请参阅 Exchange Online PowerShell V2 模块For more information about the module, see Exchange Online PowerShell V2 module.

此 PowerShell 脚本:This PowerShell script:

  • 显示每个用户的用户主体名称。Displays the user principal name for each user.
  • 为每个用户设置指定的隐私模式。Sets the specified privacy mode for each user.
  • 创建包含已处理所有用户的 .csv 文件,并显示其状态。Creates a .csv file with all the users that were processed and shows their status.