Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Re: powergadget : how to pass parameters

Reply
 
Old 01-03-2008   #1 (permalink)
Marco Shaw [MVP]


 
 

Re: powergadget : how to pass parameters

Quote:

> How to i pass the results to the chart.pgt ? Is there such thing as $a |
> out-chart -template chart.pgt <company> <column 1> <column2>, as i wish to
> pass results *on the fly* ?
You might have options in that some of the parameters might accept
scriptblocks. If the parameters accept scriptblocks, you're a bit
farther ahead, but that won't do you much good if you're just passing
simple strings to out-chart.

You're going to need to pass objects to out-chart, then determine if
particular parameters can use scriptblocks for values.

You'd be better off doing something like this:

v2 CTP>$a
Company A 10 20
Company B 11 22
v2 CTP>$a|select-object @{expression={"Company "+$_.split('
')[1]};name="Company"},@{expression={$_.split(' ')[2]};na
me="Value1"},@{expression={$_.split(' ')[3]};name="Value2"}|format-table
-autosize

Company Value1 Value2
------- ------ ------
Company A 10 20
Company B 11 22

(Now, I didn't have time to try to format the above better. Note that
it should all be on one line, and that all of the splits are just done
on a space.)

*Then*, with the last command above, for example, you can pipe specific
objects to out-chart.

v2 CTP>$a|select-object @{expression={"Company "+$_.split('
')[1]};name="Company"},@{expression={$_.split(' ')[2]};na
me="Value1"},@{expression={$_.split(' ')[3]};name="Value2"}|where-object
{$_.Company -match "Company A"}|format-table -autosize

Company Value1 Value2
------- ------ ------
Company A 10 20




--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Can I pass parameters when opening Word VB Script
Pass parameters to XBAP from webpage .NET General
Powergadget version PowerShell
printer no paper - how to pass to powergadget PowerShell
Powergadget - Out-Line PowerShell


Vista Forums 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 Ltd

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