View Single Post
Old 11-28-2007   #1 (permalink)
Joey


 
 

native command messages/errors

How do I get the verbose messages/errors displayed by native command calls
back into a variable inside of powershell or at least to show up in the
output? At the moment the closest thing I can find is the $lastexitcode
variable which is good for determining if an error occurred but doesn't help
in ascertaining the exact error message of a native command. The $error
object contains nothing when a native command fails. I want to convert my
processes over to powershell but without the ability to display exact error
messages from native commands the benefits will not outweigh the hassles of
trying to debug the scripts because the errors are not shown!

Is there a way to “pipe” the native command call to a text file and then
read that back into powershell after the command finishes? I tried to do this
but the DOS pipe “>” didn’t work for whatever reason.

E.g.
& "$TFExecutablePath\.\tf.exe workspace /delete $Name
/s:$TeamFoundationServerUrl /noprompt > c:\test.txt"

My System SpecsSystem Spec