Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell cmdlet Update-TfsWorkspace: how to capture error message?

$
0
0

I'm writing a PS script to update my tfs workspace. However, Update-TfsWorkspace doesn't throw an exception when it fails. e.g. when the user doesn't have permission to write the workspace, or the workspace cannot be determined. It only displays the message on the console. I assume it's on stderr. If I run the script and redirect like "2>logfile", I can see the message in logfile. However, if I call the cmdlet using this syntax:

Update-TfsWorkspace C:\DoesNotExist 2> logfile

It doesn't work. The error message is not in logfile, but rather output on the console. What's the best way to capture the error from this cmdlet so that I can determine the action upon a failure?

Thanks!



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>