◐ Shell
clean mode source ↗

[release/v7.5.7] Update PowerShell telemetry to respect the diagnostics and feedback setting on Windows by adityapatwardhan · Pull Request #27472 · PowerShell/PowerShell

Backport of #27328 to release/v7.5.7

Triggered by @adityapatwardhan on behalf of @daxian-dbw

Original CL Label: CL-General

/cc @PowerShell/powershell-maintainers

Impact

REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

Customer Impact

  • Customer reported
  • Found internally

This change ensures telemetry honors the Windows diagnostics and feedback setting and avoids sending telemetry when disabled.

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

Validated by cherry-pick resolution, existing telemetry tests updated in the commit, and build/runtime behavior remains gated by telemetry enablement checks.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

The change is limited to telemetry initialization gating and ETW logging paths, with no impact on core command execution.

Merge Conflicts

Resolved conflict in src/System.Management.Automation/utils/Telemetry.cs by taking the PR version and preserving release branch compatibility.