Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a PowerShell script that produces output to the screen when running it from the PowerShell command line. When I run the PowerShell script as a Scheduled Task, where can I find the output?

share|improve this question

3 Answers 3

As far as I know, you won't find it anywhere.

You'll need to either open a text file and write the output there, or write a small batch file that redirects standard output to a text file.

For example, I use a batch file something like this:

powershell test.ps1 > output.txt
share|improve this answer

You won't find your output anywhere from your scheduled task. I would suggest sending your scripts output to a text file, you can do so easily by piping your output to the out-file command, e.g.

get-mailbox |out-file c:\mailboxes.txt

Or output the whole of your files output using a standard DOS file redirect > file.txt

share|improve this answer

In a scheduled task just prefix the entire command with cmd /c

example: cmd /c powershell test.ps1 > output.txt

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.