Skip to content

Set-EXOMyAnalyticsFeatureConfig

Exchange Online Management: Configures MyAnalytics features for a user

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$Identity,
    [ValidateSet('all','add-in','dashboard','digest-email')]
    [string]$Feature,
    [bool]$IsEnabled,
    [ValidateSet('opt-in','opt-out')]
    [string]$PrivacyMode
)

Process {
    try {
        [hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'; 'Identity' = $Identity}

        if ($PSBoundParameters.ContainsKey('Feature')) {
            $cmdArgs.Add('Feature', $Feature)
        }
        if ($PSBoundParameters.ContainsKey('IsEnabled')) {
            $cmdArgs.Add('IsEnabled', $IsEnabled)
        }
        if ($PSBoundParameters.ContainsKey('PrivacyMode')) {
            $cmdArgs.Add('PrivacyMode', $PrivacyMode)
        }
        $null = Set-MyAnalyticsFeatureConfig @cmdArgs

        $result = Get-MyAnalyticsFeatureConfig -Identity $Identity -ErrorAction Stop
        $result | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force
    }
    catch { throw }
}

Name, Alias or SamAccountName of the user

MyAnalytics features to enable or disable for the user

Enable or disable the feature specified by the Feature parameter

Enable or disable MyAnalytics privacy mode for the specified user

An interactive directory of PowerShell scripts.