![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Native command redirection in Monad (MSH) How do I redirect the output from the call of a native command to my own PSHost application? I'm able to recieve the output from cmdlets but when calling a native command like tf.exe a new window is spawned and the output is not redirected. The NotifyBeginApplication() method is being called in my host application, but there are no parameters for me to hook onto the newly spawned process and redirect it. Here is an example: $TFExecutablePath = "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE" function DeleteWorkspace([String]$Name, [String]$TeamFoundationServerUrl) { $ErrorActionPreference = "stop" # delete the workspace & $TFExecutablePath\.\tf.exe workspace /delete $Name /s:$TeamFoundationServerUrl /noprompt # spit out the exit code write-Host "ExitCode: $lastexitcode" } DeleteWorkspace "Test" "MyServer" Since I'm running an external executable in this function I want to see the output from the call to it and the following statement is what I'm expecting to be redirected to my host application. TF14061: The workspace Test;domain\user does not exist. |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Native command redirection in Monad (MSH) Maybe this will help you: http://msdn2.microsoft.com/en-us/lib...ardoutput.aspx Also notice that Monad is now called Windows PowerShell. http://en.wikipedia.org/wiki/Windows_PowerShell -- greetings dreeschkind "Joey" wrote: > How do I redirect the output from the call of a native command to my own > PSHost application? I'm able to recieve the output from cmdlets but when > calling a native command like tf.exe a new window is spawned and the output > is not redirected. The > > NotifyBeginApplication() method is being called in my host application, but > there are no parameters for me to hook onto the newly spawned process and > redirect it. > > Here is an example: > > $TFExecutablePath = "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE" > > function DeleteWorkspace([String]$Name, [String]$TeamFoundationServerUrl) > { > $ErrorActionPreference = "stop" > # delete the workspace > & $TFExecutablePath\.\tf.exe workspace /delete $Name > /s:$TeamFoundationServerUrl /noprompt > # spit out the exit code > write-Host "ExitCode: $lastexitcode" > } > > DeleteWorkspace "Test" "MyServer" > > Since I'm running an external executable in this function I want to see the > output from the call to it and the following statement is what I'm expecting > to be redirected to my host application. > > TF14061: The workspace Test;domain\user does not exist. > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| native command messages/errors | PowerShell | |||
| old Monad Script fails when run in RC1 Powershell | PowerShell | |||
| Monad/Powershell Extensibility | PowerShell | |||
| Monad / PowerShell / Exchange 2007 | PowerShell | |||
| Monad | Vista General | |||