I want to store the stderr output of a PowerShell command in a variable. I don\'t want to store it in a file and I don\'t want standard output included, just the error output.>
You can call the command a slightly different way and use the -ErrorVariable parameter in PowerShell:
-ErrorVariable
Invoke-Expression "$command $params" -ErrorVariable badoutput
$badoutput will now contain the contents of the error string.
$badoutput