Public/Get-MSOnlineExtTelemetryOption.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
function Get-MSOnlineExtTelemetryOption
{
<#
.Synopsis
    Gets the telemetry options for the module.
.DESCRIPTION
    Gets the telemetry options for the module.
 
    The default state is to disable telemetry. Please concider enabling telemetry to assist with improving the MSOnlineExt module.
.EXAMPLE
    Get-MsolTenantContext
 
    This command will enable telemetry and send us on the road of improving the MSOnlineExt module.
    Thank you very much! The data will help us track errors and usage.
.INPUTS
    None
.OUTPUTS
    MSOnlineExt.TelemetryClientSetting
 
    This cmdlet will return an object that details the current state of telemtry gathering.
.NOTES
    Once the participation setting is set the telemetry warning will no longer be run.
.COMPONENT
    MSOnlineExt
.FUNCTIONALITY
    Gets the telemetry options for the module.
#>

    [CmdletBinding(SupportsShouldProcess=$false,
                   PositionalBinding=$false,
                   ConfirmImpact='Low')]
    Param ()

    Begin
    {
        $ErrorActionPreference = 'Stop'
        $script:app.TrackEvent('Ran function: {0}' -f $MyInvocation.MyCommand.Name)
    }

    Process
    {
        try
        {
            [PSCustomObject]@{
                PSTypeName = 'MSOnlineExt.TelemetryClientSetting'
                TelemetryDisabled = -not $script:app.IsEnabled()
                TelemetryDisabledInConfig = $script:module_config.ApplicationInsights.TelemetryDisable
            }
        }
        catch
        {
            $script:app.TrackException($PSItem)
            $PSCmdlet.ThrowTerminatingError($PSItem)
        }
        finally
        {
            $script:app.Flush()
        }
    }

    End
    {
    }
}