We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Reported via uservoice @ https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/13741089-get-service-name-parameter-allows-null-value
Get-Service -Name $VariableThatResultsInNullorEmptyValue or $VariableThatResultsInNullorEmptyValue | Get-Service
ParameterBinding exception saying the value is null or empty
Returns all service
> $PSVersionTable Name Value ---- ----- PSVersion 5.1.14393.206 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.14393.206 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
Reported via uservoice @ https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/13741089-get-service-name-parameter-allows-null-value
Steps to reproduce
Get-Service -Name $VariableThatResultsInNullorEmptyValue
or
$VariableThatResultsInNullorEmptyValue | Get-Service
Expected behavior
ParameterBinding exception saying the value is null or empty
Actual behavior
Returns all service
Environment data