Table of Contents
Wellbeing for All, Unless You Want to Disable the Fitness Tracker for Work
Updated 4 September 2021
Recently Office 365 users have received email from the MyAnalytics service (Figure 1) apparently out of the blue. Being coached about the steps to achieving wellbeing is all very well, but you’d like to be asked whether you need to use the “fitness tracker for work.”
The reason why this is happening is that Microsoft decided in January 2019 to remove MyAnalytics from its previous status of only being available in the Office 365 E5 plan or as a separate add-on and make the service available for everyone with an Exchange Online license (see roadmap item 52276). They are now getting around to rolling out the feature (see Office 365 notification MC186372 of July 23, 2019).
Disabling MyAnalytics
Even though the data is personal and is never shared with others, some people hate the idea of Office 365 analyzing and reporting their activity, let alone sending well-intended messages to help them work smarter, which is why you might need to disable MyAnalytics for the entire tenant (perhaps to prepare users for its introduction) or for individual users (mailboxes).
There are two ways to disable MyAnalytics: for the tenant or for an Exchange Online mailbox. To disable MyAnalytics for a tenant, go to the Settings section of the Microsoft 365 Admin Center, then Org settings, and finally select MyAnalytics from the list. You can now select the default settings to apply to all mailboxes (Figure 2). You can disable just the weekly message to encourage better work habits by unchecking Weekly insights email.
The weekly digest messages sent by MyAnalytics are interesting. They are submitted direct to user mailboxes and don’t seem to go through the Exchange Online transport service. If they do, the items pick up no message headers and no trace is left in the message tracking logs. Another minor irritation is that tenants have no control when the messages are delivered; they arrive when MyAnalytics is ready.
User Settings
Users can go to the MyAnalytics dashboard (selectable from the Office 365 waffle menu), and disable the service from the Settings menu (Figure 3). Note that it can take up to a week for changes to take effect, which means that a user might receive another email while the setting change is being implemented.
Users can also opt out of receiving the weekly email using the unsubscribe link in the message.
Updating the Analytics Mailbox Settings with PowerShell
Alternatively, you can run the PowerShell Set-MyAnalyticsFeatureConfig cmdlet to update the MyAnalytics privacy setting for mailboxes . The Get-MyAnalyticsFeatureConfig cmdlet is also available to check the current state of affairs. Previous to the introduction of the V2.0.4 of the Exchange Online Management module (or later), the cmdlets were Set-UserAnalyticsConfig and Get-UserAnalyticsConfig. Both sets of cmdlets use the same syntax. For example:
# Report what mailboxes are enabled for MyAnalytics
$Mbx = Get-ExoMailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited | Select DisplayName, UserPrincipalName
$MyAnalyticsCount = 0
ForEach ($M in $Mbx) {
$MyAnalytics = Get-MyAnalyticsFeatureConfig -Identity $M.UserPrincipalName | Select PrivacyMode
If ($MyAnalytics.PrivacyMode -eq "opt-in") {
$MyAnalyticsCount++
Write-Host "MyAnalytics is enabled for" $M.DisplayName }
Else { Write-Host "MyAnalytics is not enabled for" $M.DisplayName}
}
Write-Host "MyAnalytics is enabled for" $MyAnalyticsCount "of" $Mbx.Count "mailboxes"
The PrivacyMode setting governs whether data for a mailbox is used by MyAnalytics. In this example, we select mailboxes based on their CustomAttribute7 attribute, which we set to “NoMyAnalytics” when a mailbox has been removed from MyAnalytics processing.
# Disable Selected Mailboxes for MyAnalytics
$Mbx = Get-ExoMailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited -Filter {CustomAttribute7 -eq "NoMyAnalytics"} | Select DisplayName, UserPrincipalName
ForEach ($M in $Mbx) {
Write-Host "Disabling MyAnalytics for" $M.DisplayName
Set-MyAnalyticsFeatureConfig -Identity $M.UserPrincipalName -PrivacyMode "opt-out" }
The Set-MyAnalyticsFeatureConfig cmdlet can control individual mailbox feature settings for analytics. Three feature settings are currently available:
- Dashboard: Access to the MyAnalytics dashboard.
- Add-in: Access to the Outlook Insights add-in.
- Digest-email: Access to the email digest.
You can opt-in mailboxes for analytics but block individual features. For instance, here’s how to block the digest email while allowing users to access the dashboard and Outlook add-in:
$Mbx = Get-ExoMailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited | Select DisplayName, UserPrincipalName
ForEach ($M in $Mbx) {
Write-Host "Disabling the monthly analytics digest email for" $M.DisplayName
Set-MyAnalyticsFeatureConfig -Identity $M.UserPrincipalName -PrivacyMode "opt-in" -Feature digest-email -IsEnabled $False}
If you examine mailbox details afterwards, you should find that the account is enabled for analytics but won’t receive the mail digest:
Get-MyAnalyticsFeatureConfig -Identity Stale.Hansen@office365itpros.com | ft UserId, PrivacyMode, IsDigestEmailEnabled UserId PrivacyMode IsDigestEmailEnabled ------ ----------- -------------------- Stale.Hansen@office365itpros.com opt-in False
Removing the MyAnalytics License from User Accounts
If you need to remove MyAnalytics totally for a mailbox, the best approach is to remove the Insights by MyAnalytics license assigned to the account. You can do this in the Microsoft 365 admin center by selecting the account and editing the Apps section of the license configuration to uncheck Insights by MyAnalytics. It’s also possible to do this with PowerShell. Here’s an example. The code uses a mixture of Microsoft Online Services and Exchange Online cmdlets to remove the MyAnalytics license from users with Office 365 E3 licenses.
- Define a new license option which excludes MyAnalytics. You must change the definition of the $Office365E3License variable to replace “yourtenantname” with the actual name of your tenant. If you want to remove the MyAnalytics license from users with other Office 365 licenses, you’ll need to add some more code to process these licenses.
- Read in a set of users for which we want to remove MyAnalytics license. I use a distribution group here. You could also create a list by applying a filter to select a set of Azure Active Directory accounts or Exchange Online mailboxes.
- For each user, set the new license option with the Set-MsolUserLicense cmdlet.
- To make sure that we don’t process the user again, set the CustomAttribute8 property of their mailbox with a value to indicate that the license is removed.
# Remove MyAnalytics licenses from Office 365 accounts
$Office365E3License = "yourtenantname:ENTERPRISEPACK"
$NewE3Options = New-MsolLicenseOptions -AccountSkuId $Office365E3License -DisabledPlans "MYANALYTICS_P2"
$Users = Get-DistributionGroupMember -Identity NoMyAnalytics
Foreach ($U in $Users) {
If ((Get-ExoMailbox -Identity $U.WindowsLiveId).CustomAttribute8 -ne "MyAnalytics disabled") {
Write-Host "Disabling MyAnalytics for" $U.DisplayName
Set-MsolUserLicense -UserPrincipalName $U.WindowsLiveId -LicenseOptions $NewE3Options
Set-Mailbox -Identity $U.WindowsLiveId -CustomAttribute8 "MyAnalytics disabled" }
}
Like all PowerShell samples, this code is intended to illustrate a principal. It works, but it might not be what you want to use in production on an ongoing basis. A more developed version of code which can handle the removal of any individual service plan from an Office 365 SKU is described here.
We cover MyAnalytics in the companion volume of the Office 365 for IT Pros eBook. That doesn’t mean that the information isn’t valuable: it simply means that we have tons of other stuff to discuss in the main book. However, we do cover the topic of removing licenses from Office 365 accounts with PowerShell in Chapter 4…
