Skip to content

Commit

Permalink
Add option to suppress telemetry reminder (#206)
Browse files Browse the repository at this point in the history
Adds a new global variable that users can set to keep telemetry enabled
but suppress the per-session reminder that telemetry is enabled.
  • Loading branch information
HowardWolosky committed Aug 25, 2020
1 parent 20d94bb commit 49e289e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 4 additions & 5 deletions Documentation/USAGE.md
Expand Up @@ -1027,11 +1027,10 @@ employed during execution of commands within this module (via Application Insigh
information, refer to the [Privacy Policy](../README.md#privacy-policy) and
[Terms of Use](../README.md#terms-of-use).

> You may notice some needed assemblies for communicating with Application Insights being
> downloaded on first run of a StoreBroker command within each PowerShell session. The
> [automatic dependency downloads](SETUP.md#automatic-dependency-downloads) section of the setup
> documentation describes how you can avoid having to always re-download the telemetry assemblies
> in the future.
With every new PowerShell session, StoreBroker will show you a reminder that telemetry is being
used. You can suppress this reminder in the future by setting the following:

$global:SBSuppressTelemetryReminder = $true

We recommend that you always leave the telemetry feature enabled, but a situation may arise where
it must be disabled for some reason. In this scenario, you can disable telemetry by setting
Expand Down
10 changes: 9 additions & 1 deletion StoreBroker/Telemetry.ps1
Expand Up @@ -97,6 +97,11 @@ function Initialize-TelemetryGlobalVariables
$global:SBDisableTelemetry = $false
}

if (!(Get-Variable -Name SBSuppressTelemetryReminder -Scope Global -ValueOnly -ErrorAction Ignore))
{
$global:SBSuppressTelemetryReminder = $false
}

if (!(Get-Variable -Name SBDisablePiiProtection -Scope Global -ValueOnly -ErrorAction Ignore))
{
$global:SBDisablePiiProtection = $false
Expand Down Expand Up @@ -184,7 +189,10 @@ function Get-BaseTelemetryEvent

if ($null -eq $script:SBBaseTelemetryEvent)
{
Write-Log -Message "Telemetry is currently enabled. It can be disabled by setting ""`$global:SBDisableTelemetry = `$true"". Refer to USAGE.md#telemetry for more information."
if (-not $global:SBSuppressTelemetryReminder)
{
Write-Log -Message "Telemetry is currently enabled. It can be disabled by setting ""`$global:SBDisableTelemetry = `$true"". Refer to USAGE.md#telemetry for more information. Stop seeing this message in the future by setting `"`$global:SBSuppressTelemetryReminder=`$true`""
}

$username = Get-PiiSafeString -PlainText $env:USERNAME

Expand Down

0 comments on commit 49e289e

Please sign in to comment.