I bumped in the error [WayBack] “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 properties do not match any of the parameters that take pipeline input.” when using [WayBack] Write-Output where [WayBack] Select-Object worked just fine.
This happened when playing around with detecting empty Chocolatey .nupkg package files.
$LibPath = Join-Path $env:ChocolateyInstall 'lib' $NupkgFilter = '*.nupkg' Get-ChildItem -Path $LibPath -Recurse -Filter $NupkgFilter | Where-Object {($_.Length -eq 0) -and ($_.BaseName -eq "hg")} | Sort-Object LastWriteTime | Select-Object BaseName <# Get-ChildItem -Path $LibPath -Recurse -Filter $NupkgFilter | Where-Object {($_.Length -eq 0) -and ($_.BaseName -eq "hg")} | Sort-Object LastWriteTime | Write-Output BaseName ## Write-Output : 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 properties do not match any of the parameters that take pipeline input. #> Get-ChildItem -Path $LibPath -Recurse -Filter $NupkgFilter | Where-Object {($_.Length -eq 0) -and ($_.BaseName -eq "hg")} | Sort-Object LastWriteTime | ForEach-Object { Write-Output $_.BaseName }
The output is also slightly different, hinting on the root cause:
BaseName -------- hg hg
The above shows that Select-Object selects a list of BaseName properties (italic part), whereas Write-Output shows a single BaseName property content (bold part).























