Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

scheduled task output is truncated

Closed Thread
 
Thread Tools Display Modes
Old 07-11-2007   #1 (permalink)
Neil Chambers
Guest


 

scheduled task output is truncated

I have a powershell script run as a scheduled task - as such CMD.EXE is
used to launch psh. The script attaches a table of data to
Send-SmtpMail - but when it does this running under cmd.exe the table
output is truncated to the size of the command window.

I don't seem to be able to use a modified shortcut to CMD.EXE in order
to change the layout to a suitable size and I can't find reference on
how to change this setting at runtime.

Any ideas?

Cheers,
Neil

Old 07-11-2007   #2 (permalink)
Keith Hill
Guest


 

Re: scheduled task output is truncated

"Neil Chambers" <n3llyb0y@aol.com> wrote in message
news:2007071115305143658-n3llyb0y@aolcom...
>I have a powershell script run as a scheduled task - as such CMD.EXE is
>used to launch psh.


Why not launch Powershell.exe directly from the scheduled task? I have
several scheduled tasks that do just this:

C:\windows\system32\WindowsPowershell\v1.0\powershell.exe -command
c:\bin\CatalogFileSystem.ps1 C: D:

When generating the table can you use format-table's -width parameter to
force the output to be wider?

--
Keith

Old 07-11-2007   #3 (permalink)
Neil Chambers
Guest


 

Re: scheduled task output is truncated

On 2007-07-11 16:17:24 +0100, "Keith Hill"
<r_keith_hill@mailhot.moc.no_spam_I> said:

> "Neil Chambers" <n3llyb0y@aol.com> wrote in message
> news:2007071115305143658-n3llyb0y@aolcom...
>> I have a powershell script run as a scheduled task - as such CMD.EXE is
>> used to launch psh.

>
> Why not launch Powershell.exe directly from the scheduled task? I have
> several scheduled tasks that do just this:
>
> C:\windows\system32\WindowsPowershell\v1.0\powershell.exe -command
> c:\bin\CatalogFileSystem.ps1 C: D:
>
> When generating the table can you use format-table's -width parameter
> to force the output to be wider?


my bad. What I meant to say was that I am calling powershell directly
from the scheduler and I thought it was cmd.exe that actually launched
powershell but I see now that it is svchost.exe responsible for calling
powershell but it still looks like a cmd.exe command window (same
default height, width) when the task first kicks off?

AFAICT there is no -width parameter. There is a -wrap parameter which
does give me all of the output but, as you can probably guess, as
wrapped text (which is just not cricket).

Is there any way at all I can just specify the default size of the
command window? (and now I'm really confused - does powershell launch
directly or is it being called via cmd/svchost?) argh!

Cheers,
neil


Old 07-11-2007   #4 (permalink)
Keith Hill [MVP]
Guest


 

Re: scheduled task output is truncated

"Neil Chambers" <n3llyb0y@aol.com> wrote in message
news:200707111648318930-n3llyb0y@aolcom...
> AFAICT there is no -width parameter. There is a -wrap parameter which does
> give me all of the output but, as you can probably guess, as wrapped text
> (which is just not cricket).
>
> Is there any way at all I can just specify the default size of the command
> window? (and now I'm really confused - does powershell launch directly or
> is it being called via cmd/svchost?) argh!


You can modify the width properties of the console window that appears but
that is a bit brittle. You can try sending your output through Out-String.
That is the cmdlet that has a -width parameter not format-table (sorry for
sending you down the wrong path). I've attached a logging function library
that I use that works pretty good although it doesn't capture output written
directly to the host.

--
Keith

Old 07-12-2007   #5 (permalink)
Neil Chambers
Guest


 

Re: scheduled task output is truncated

On 2007-07-11 21:43:59 +0100, "Keith Hill [MVP]"
<r_keith_hill@mailhot.moc_no_spam_I> said:

>
>
> "Neil Chambers" <n3llyb0y@aol.com> wrote in message
> news:200707111648318930-n3llyb0y@aolcom...
>> AFAICT there is no -width parameter. There is a -wrap parameter which
>> does give me all of the output but, as you can probably guess, as
>> wrapped text (which is just not cricket).
>>
>> Is there any way at all I can just specify the default size of the
>> command window? (and now I'm really confused - does powershell launch
>> directly or is it being called via cmd/svchost?) argh!

> You can modify the width properties of the console window that appears
> but that is a bit brittle. You can try sending your output through
> Out-String. That is the cmdlet that has a -width parameter not
> format-table (sorry for sending you down the wrong path). I've
> attached a logging function library that I use that works pretty good
> although it doesn't capture output written directly to the host.


Thanks again, Keith. It appears this issue is just going to plague me,
though. Out-String is neat but when the console window is less that the
output string, the line wraps.

I'm just going to modify the table output to be 80 char friendly :-)

Cheers,
Neil


Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing scheduled task? SonicJoe Vista performance & maintenance 6 11-07-2007 01:48 PM
Scheduled task from standby---help! ksipp01 Vista General 12 11-04-2007 12:29 PM
Scheduled task failed njem Vista General 0 08-20-2007 04:53 PM
How do you rename a scheduled task Keith Hill [MVP] Vista account administration 3 07-26-2007 12:32 PM
Can a Scheduled Task be renamed? Fred B. Vista General 4 05-03-2007 05:05 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50