[release/v7.4.16] Update PowerShell telemetry to respect the diagnostics and feedback setting on Windows#27430
Open
adityapatwardhan wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Backport of #27328 to release/v7.4.16. Updates PowerShell telemetry on Windows to respect the OS-level diagnostics and feedback setting via the WinRT IPlatformDiagnosticsAndUsageDataSettingsStatics API, with an ETW event for failure logging.
Changes:
- Add
WindowsDataCollectionSettingusing source-generated COM interop to query the WinRT diagnostics setting; gate telemetry onEnhancedlevel. - Add new ETW event/task (
Telemetry_Setting_Error,Telemetry) plus manifest entries (also syncs WDAC entries to match PowerShell-Native). - Fix
CoUninitializebalancing inIsStaSupported(>=0instead of>0) and update Telemetry tests to skip when OS telemetry level < Enhanced.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/System.Management.Automation/utils/WindowsDataCollectionSetting.cs | New WinRT interop wrapper to query platform data collection level. |
| src/System.Management.Automation/utils/Telemetry.cs | Gates CanSendTelemetry on the Windows diagnostics setting. |
| src/System.Management.Automation/engine/remoting/common/PSETWTracer.cs | Adds Telemetry_Setting_Error event ID and Telemetry task. |
| src/System.Management.Automation/CoreCLR/CorePsPlatform.cs | Balances CoUninitialize for both S_OK and S_FALSE results. |
| src/PowerShell.Core.Instrumentation/PowerShell.Core.Instrumentation.man | Adds telemetry event/task/template; syncs WDAC entries. |
| test/powershell/engine/Basic/Telemetry.Tests.ps1 | Skips telemetry tests when OS telemetry level is below Enhanced. |
Member
Member
Author
|
close, this need to be done after #27453 |
4b1a642 to
ca0e1c1
Compare
SeeminglyScience
approved these changes
May 15, 2026
daxian-dbw
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #27328 to release/v7.4.16
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
No tooling workflow changes required for consumers; this backport updates runtime telemetry initialization behavior and ETW manifest/resources.
Customer Impact
Ensures telemetry behavior on Windows respects the diagnostics and feedback setting, aligning with expected privacy/collection controls.
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
Cherry-pick applied with one conflict in Telemetry.cs resolved to preserve release-branch initialization while adding diagnostics-setting gating. Included telemetry test updates from the original PR; build and CI validation will run on the backport PR.
Risk
REQUIRED: Check exactly one box.
Touches telemetry initialization and ETW related code paths on Windows; behavior change is intentional but affects startup/telemetry enabling logic.
Merge Conflicts
Resolved a conflict in src/System.Management.Automation/utils/Telemetry.cs by combining release/v7.4.16 branch structure with the original PR's Windows diagnostics-and-feedback gate logic, then completed cherry-pick without remaining conflict markers.