In a function that retrieve parameters from pipeline, if you make a parameter mandatory (Mandatory=$true
), you will get error when an empty line is passed from the pipeline.
If you receive parameters from the data which may contain empty lines (e.g. content of text files), you should set Mandatory=$false
, or filter empty lines (Where-Object { $_.length -gt 0 }
) before pass them to the function.