Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 571549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:31:08+00:00 2026-05-13T13:31:08+00:00

I need to execute some periodic console applications that give me some results (on

  • 0

I need to execute some periodic console applications that give me some results (on the console)… How can I execute it and have its return data sent to my email?
I tried to use [Diagnostics.Process]::Start() and it launches my application but i don’t know how to get the return… I do not want the exitCode, I want the text that the application prints on screen.
Using PS V2 CTP3.

*** UPDATE

The solutions presented worked fine but i have a problem… this application that i need to execute is gfix from the firebird database and now i discovered a thing, I can’t redirect the output of gfix to a file, if i execute on command prompt the line:

gfix.exe -v -f dabatase.gdb > c:\test.txt

it print the output on the screen and the file is empty.
Same thing if I try to assign it to a variable… I don’t know what difference gfix has from the other console apps that I use, but looks like its output can’t be redirected.

Has someone seeing this?

*** UPDATE 2

Even if I use Start-transcript /Stop-Transcript, although on the screen I see the gfix output, on the file there is only the commands :/

*** UPDATE 3

Found the solution here
http://edn.embarcadero.com/br/article/25605

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:31:08+00:00Added an answer on May 13, 2026 at 1:31 pm

    Something like this could work:

    # temporary file
    $f = [io.path]::GetTempFileName()
    # start process and redirect its output to the temp file
    ping localhost > $f
    
    # create and send email
    $emailFrom = "user@yourdomain.com"
    $emailTo = "user@yourdomain.com"
    $subject = "results"
    $body = (Get-Content $f) -join "`r`n"
    $smtpServer = "your smtp server"
    $smtp = new-object Net.Mail.SmtpClient($smtpServer)
    $smtp.Send($emailFrom, $emailTo, $subject, $body)
    
    # delete the file
    remove-item $f
    

    I think in this case [Diagnostics.Process]::Start() is not needed. Besides that there is a cmdlet Start-Process that does almost the same.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple page that I need to execute some GWO & GATC
I have a query that I need to execute that I do not know
I need to execute some custom code before IControllerFactory.GetControllerInstance() is called. I have looked
I have an ASP textbox control where I need to execute some javascript function
I need to execute some dynamically generated code in Python and ensure that this
I need to execute some common code for several 'around' advices. So, I have
I have an entity. I need to execute some JS code when entity loads
Let us say I have one supervisor and I need execute some start_child for
I have <h:inputText> on form and what I need is to execute some method
I need to execute some additional configuration after installation so I have created a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.