Why am I getting the error for the code below:
Get-Job -Id 1 | Select-Object -ExpandProperty childjobs | Where-Object {$_.state -eq 'Completed'} | Select-Object -ExpandProperty id | Receive-Job
Receive-Job : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its propertie s do not match any of the parameters that take pipeline input. At line:1 char:147 + Get-Job -Id 1 | Select-Object -ExpandProperty childjobs | Where-Object {$_.state -eq 'Completed'} | Select-Object -ExpandProperty id | Receive-Job <<<<
+ CategoryInfo : InvalidArgument: (2:PSObject) [Receive-Job], ParameterBindingException + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.ReceiveJobCommand
However, this line works perfectly:
Receive-Job (Get-Job -Id 1 | Select-Object -ExpandProperty childjobs | Where-Object {$_.state -eq 'Completed'} | Select-Object -ExpandProperty id )
Any tips or helpful comments on the code are appreciated. I'm new to PowerShell.
Thanks