Skip to content

Add verbose message to Get-Service when properties cannot be returned#27109

Merged
daxian-dbw merged 6 commits intoPowerShell:masterfrom
reabr:add-verbose-to-get-service
Mar 31, 2026
Merged

Add verbose message to Get-Service when properties cannot be returned#27109
daxian-dbw merged 6 commits intoPowerShell:masterfrom
reabr:add-verbose-to-get-service

Conversation

@reabr
Copy link
Copy Markdown
Contributor

@reabr reabr commented Mar 27, 2026

Fixes #24272

PR Summary

Adds verbose messages to Get-Service when certain service properties
cannot be retrieved due to permissions or other issues.

When Get-Service fails to read properties like Description,
DelayedAutoStart, BinaryPathName, StartupType or UserName, it now emits
a verbose message explaining which service, which property, and why it
failed. The message is only visible when using -Verbose, so it is
non-intrusive by default.

PR Context

This implements the behavior approved by the WG-Cmdlets-Management working
group in issue #24272. The verbose stream was chosen over debug stream as
most users rerun with -Verbose to diagnose issues.

Tested

Verified locally that verbose messages appear for services with missing
MUI resources (e.g. NPSMSvc, WaaSMedicSvc) when running Get-Service -Verbose.

@reabr reabr requested a review from a team as a code owner March 27, 2026 19:37
@reabr
Copy link
Copy Markdown
Contributor Author

reabr commented Mar 27, 2026

@microsoft-github-policy-service agree

@reabr
Copy link
Copy Markdown
Contributor Author

reabr commented Mar 27, 2026

Hi, could a maintainer please approve the workflows to run?
This implements the behavior approved in #24272. Thank you!

Comment thread src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs Outdated
Comment thread src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs Outdated
@reabr reabr requested a review from daxian-dbw March 31, 2026 11:17
@mhdipozn-cmd mhdipozn-cmd mentioned this pull request Mar 31, 2026
Copy link
Copy Markdown
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @reabr!

@daxian-dbw daxian-dbw added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Mar 31, 2026
@daxian-dbw daxian-dbw merged commit 30f70ee into PowerShell:master Mar 31, 2026
36 of 37 checks passed
@reabr reabr deleted the add-verbose-to-get-service branch March 31, 2026 19:58
daxian-dbw pushed a commit to daxian-dbw/PowerShell that referenced this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add verbose message to Get-Service when certain properties cannot be returned

2 participants