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...}
Filed on UserVoice: http://windowsserver.uservoice.com/forums/301869/suggestions/17193962
The error message for
Get-Servicereturns aNoServiceFoundForGivenNameexception even when the problem is an invalid-ComputerName, potentially misleading the user.Steps to reproduce
Expected behavior
Actual behavior
Environment data