Skip to content

Get-Service | Empty fields dedicated to error messages #20187

@Ricky-Tigg

Description

@Ricky-Tigg

Prerequisites

Steps to reproduce

Get-Service | Where-Object {$_.Status -eq "running"} | Format-Table -AutoSize -Property Name,DisplayName

Expected behavior

Non-empty fields dedicated to error messages.

Actual behavior

Empty fields dedicated to error messages. As part of the output:


Get-Service: Service 'McpManagementService (McpManagementService)' cannot be queried due to the following error:
Get-Service: Service 'NPSMSvc_329b6 (NPSMSvc_329b6)' cannot be queried due to the following error:

Error details

Exception             :
    Type        : Microsoft.PowerShell.Commands.ServiceCommandException
    ServiceName : NPSMSvc_329b6
    Message     : Service 'NPSMSvc_329b6 (NPSMSvc_329b6)' cannot be queried due to the following error:
    HResult     : -2146233087
TargetObject          : System.ServiceProcess.ServiceController
CategoryInfo          : PermissionDenied: (System.ServiceProcess.ServiceController:ServiceController) [Get-Ser
vice], ServiceCommandException
FullyQualifiedErrorId : CouldNotGetServiceInfo,Microsoft.PowerShell.Commands.GetServiceCommand
InvocationInfo        :
    MyCommand        : Get-Service
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 1
    Line             : Get-Service | Where-Object {$_.Status -eq "running"} | Format-Table -AutoSize -Property
 Name,DisplayName
    Statement        : Get-Service
    PositionMessage  : At line:1 char:1
                       + Get-Service | Where-Object {$_.Status -eq "running"} | Format-Table - …
                       + ~~~~~~~~~~~
    InvocationName   : Get-Service
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

PSVersion                      7.4.0-preview.5
PSEdition                      Core
GitCommitId                    7.4.0-preview.5
OS                             Microsoft Windows 10.0.22000
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

_

Metadata

Metadata

Assignees

No one assigned

    Labels

    In-PRIndicates that a PR is out for the issueIssue-BugIssue has been identified as a bug in the product

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions