Write to the output between two pipeline
up vote
1
down vote
favorite
I'm trying to write to the output (echo) within two pipe to have a trace of what I'm doing but I have an error. Get-ChildItem $path -Recurse | Where-Object { $_.Name -match '.+?.log.(d{4})-(d{2})-(d{2})$' -and $_.LastWriteTime -lt $deleteDate } | Write-Output "deleting file" -PassThru | Remove-Item but I have this error : 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. I also tested in the Foreach-Object function Get-ChildItem $path -Recurse | Where-Object { $_.Name -match '.+?.log.(d{4})-(d{2})-(d{2})$' -and $_.LastWriteTime -lt $deleteDate } | Foreach-Object...