![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | Powershell, Process and StandardError Hi guys, I have a funny situation here and I hope you might help me. We've written general purpose tool that executes PS scripts using System.Diagnostics.Process class and based if there is somethign in Process.StandardError decides if the script was executed successfuly. So far so good... we have also PS script that performs Oracle backup using it's external exp command and this is where is the problem. It seems exp writes output in StandardOutput AND in StandardError streams. I tried to redirect output to file but it redirects only StandardOutput text and Error text stays... thus we get always failure detected in our code... Is trere a way to clear Process.StandardError within PS script? Do you have any suggestions? Thanks in advance Galin Iliev [MCT, MCDP] |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Powershell, Process and StandardError Did you try redirecting StdErr to StrOut 2>&1 You can also try $error.clear() at the end of you script to see if that helps. "Galin Iliev[Galcho]" <Galin Iliev[Galcho]@discussions.microsoft.com> wrote in message news:37405B38-0BBD-479B-BDDC-6F0EBB9F5CA0@microsoft.com... > Hi guys, > I have a funny situation here and I hope you might help me. > We've written general purpose tool that executes PS scripts using > System.Diagnostics.Process class and based if there is somethign in > Process.StandardError decides if the script was executed successfuly. > > So far so good... we have also PS script that performs Oracle backup using > it's external exp command and this is where is the problem. It seems exp > writes output in StandardOutput AND in StandardError streams. I tried to > redirect output to file but it redirects only StandardOutput text and > Error > text stays... > thus we get always failure detected in our code... > > Is trere a way to clear Process.StandardError within PS script? > > Do you have any suggestions? > > Thanks in advance > Galin Iliev [MCT, MCDP] |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Powershell, Process and StandardError Thank you Brandon! This is what I looked for ![]() Many Thanks Galin Ilieb "Brandon Shell" wrote: > Did you try redirecting StdErr to StrOut 2>&1 > You can also try $error.clear() at the end of you script to see if that > helps. > > "Galin Iliev[Galcho]" <Galin Iliev[Galcho]@discussions.microsoft.com> wrote > in message news:37405B38-0BBD-479B-BDDC-6F0EBB9F5CA0@microsoft.com... > > Hi guys, > > I have a funny situation here and I hope you might help me. > > We've written general purpose tool that executes PS scripts using > > System.Diagnostics.Process class and based if there is somethign in > > Process.StandardError decides if the script was executed successfuly. > > > > So far so good... we have also PS script that performs Oracle backup using > > it's external exp command and this is where is the problem. It seems exp > > writes output in StandardOutput AND in StandardError streams. I tried to > > redirect output to file but it redirects only StandardOutput text and > > Error > > text stays... > > thus we get always failure detected in our code... > > > > Is trere a way to clear Process.StandardError within PS script? > > > > Do you have any suggestions? > > > > Thanks in advance > > Galin Iliev [MCT, MCDP] > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| is there a way to process large files in powershell? | PowerShell | |||
| Re: How to check for Powershell process | PowerShell | |||
| pipe to non-powershell process | PowerShell | |||
| Powershell Execute process | PowerShell | |||
| the powershell.exe process is grow | PowerShell | |||