Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Improve error message for Get-Service with an invalid ComputerName #2747

Copy link
Copy link
@joeyaiello

Description

@joeyaiello
Issue body actions

Filed on UserVoice: http://windowsserver.uservoice.com/forums/301869/suggestions/17193962

The error message for Get-Service returns a NoServiceFoundForGivenName exception even when the problem is an invalid -ComputerName, potentially misleading the user.

Steps to reproduce

Get-Service wuauserv -ComputerName MadeUpComputerName

Expected behavior

Get-Service : Cannot find any computer with name 'MadeUpComputerName'.
At line:1 char:1
+ Get-Service wuauserv -ComputerName MadeUpComputerName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (wuauserv:String) [Get-Service], ServiceCommandExce
   ption
    + FullyQualifiedErrorId : SomeOtherExceptionForComputerNameNotFound,Microsoft.PowerShell.Commands.GetService
   Command

Actual behavior

Get-Service : Cannot find any service with service name 'wuauserv'.
At line:1 char:1
+ Get-Service wuauserv -ComputerName MadeUpComputerName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (wuauserv:String) [Get-Service], ServiceCommandExce
   ption
    + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetService
   Command

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSRemotingProtocolVersion      2.3
PSVersion                      6.0.0-alpha
WSManStackVersion              3.0
BuildVersion                   3.0.0.0
SerializationVersion           1.1.0.1
PSEdition                      Core
GitCommitId                    v6.0.0-alpha.12
CLRVersion
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.