This code gives you the error, “An Empty Pipe Element is not Allowed Here”:
$files = Get-ChildItem foreach ($file in $files) {$file.FullName } | Out-GridView -title "Example"
The workaround which solves this problem is to make it an array by enclosing the code in @(), Example:
$files = Get-ChildItem @(foreach ($file in $files) {$file.FullName }) | Out-GridView -title "Example"