I'm trying to limit a pipeline output to those elements where a certain command's exit code is 0.
$myData | where { $temp = sqlcmd -i Checker.sql -v DATA=$_; $LASTEXITCODE -eq 0 }
Checker.sql raises an error if the data doesn't pass the check.
Is there a way to tell PowerShell to ignore the output of sqlcmd without putting it into a temp variable? If I don't include the $temp =, I just get back my original data set. Thanks!