Steps to reproduce
Get-Random -InputObject @('zzz', 'aaa', '')
Get-Random @('zzz', 'aaa', '')
Expected behavior
InputObject parameter position value is 1, so these command should work the same way and return one of the array elements.
Actual behavior
While the second command works, first command produces error:
Get-Random : Cannot validate argument on parameter 'InputObject'. The argument is null or empty. Provide an argument th
at is not null or empty, and then try the command again.
At line:1 char:25
+ Get-Random -InputObject @('zzz', 'aaa', '')
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Random], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetRandomCommand
Environment data
> $PSVersionTable
Name Value
---- -----
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.3
BuildVersion 3.0.0.0
WSManStackVersion 3.0
PSVersion 6.0.0-alpha
CLRVersion
PSEdition Core
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
GitCommitId v6.0.0-alpha.18
Name Value
---- -----
PSVersion 5.1.15063.138
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.138
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Steps to reproduce
Expected behavior
InputObject parameter position value is 1, so these command should work the same way and return one of the array elements.
Actual behavior
While the second command works, first command produces error:
Environment data