Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Windows PowerShell Programming ISBN: 978-0-470-17393-0
This is the forum to discuss the Wrox book Professional Windows PowerShell Programming: Snapins, Cmdlets, Hosts and Providers by Arul Kumaravel, Jon White, Michael Naixin Li, Scott Happell, Guohui Xie, Krishna C. Vutukuri; ISBN: 9780470173930
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Windows PowerShell Programming ISBN: 978-0-470-17393-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 17th, 2008, 12:42 AM
Registered User
 
Join Date: Dec 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default getting formatted output in hosted powershell

I've followed along with the examples in chapter 6 (hosting powershell in applications) and have a working app. I have a problem when trying to get the output of a pipeline like "dir | format-table". All of the examples show simply calling the ToString() method on each of the PSObjects in the collection returned (which works if you leave the format-table off), but the objects returned by the format-table cmdlet are apparently internal not-really-documented (couldn't find them in MSDN, for example) and don't implement anything for ToString() other than outputing the typename.

For example, I get the following:
Microsoft.PowerShell.Commands.Internal.Format.Form atStartData
Microsoft.PowerShell.Commands.Internal.Format.Grou pStartData
Microsoft.PowerShell.Commands.Internal.Format.Form atEntryData
Microsoft.PowerShell.Commands.Internal.Format.Form atEntryData
Microsoft.PowerShell.Commands.Internal.Format.Form atEntryData
Microsoft.PowerShell.Commands.Internal.Format.Form atEntryData
Microsoft.PowerShell.Commands.Internal.Format.Grou pEndData
Microsoft.PowerShell.Commands.Internal.Format.Form atEndData

I have grabbed these objects in a real powershell session (not in my app) and tried to figure out how to get anything resembling output out of them to no avail. Can you point me somewhere helpful?
Reply With Quote
  #2 (permalink)  
Old January 8th, 2009, 08:20 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default RE: getting formatted output in hosted powershell

Quote:
Originally Posted by Mike Shepard View Post
I've followed along with the examples in chapter 6 (hosting powershell in applications) and have a working app. I have a problem when trying to get the output of a pipeline like "dir | format-table". All of the examples show simply calling the ToString() method on each of the PSObjects in the collection returned (which works if you leave the format-table off), but the objects returned by the format-table cmdlet are apparently internal not-really-documented (couldn't find them in MSDN, for example) and don't implement anything for ToString() other than outputing the typename.

For example, I get the following:
Microsoft.PowerShell.Commands.Internal.Format.Form atStartData
Microsoft.PowerShell.Commands.Internal.Format.Grou pStartData
Microsoft.PowerShell.Commands.Internal.Format.Form atEntryData
Microsoft.PowerShell.Commands.Internal.Format.Form atEntryData
Microsoft.PowerShell.Commands.Internal.Format.Form atEntryData
Microsoft.PowerShell.Commands.Internal.Format.Form atEntryData
Microsoft.PowerShell.Commands.Internal.Format.Grou pEndData
Microsoft.PowerShell.Commands.Internal.Format.Form atEndData

I have grabbed these objects in a real powershell session (not in my app) and tried to figure out how to get anything resembling output out of them to no avail. Can you point me somewhere helpful?
Format-Table is meant to be the last cmdlet used in a pipeline. Once you use Format-Table, you're basically stuck with the objects that are outputted, and you cannnot do any further manipulation of the objects that are returned.

Maybe you can share more details on what you're trying to accomplish?
Reply With Quote
  #3 (permalink)  
Old October 8th, 2009, 03:42 AM
Registered User
 
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I too have the same problem. I am trying to display the objects returned from my cmdlet to the console. But inside the host I donot have any idea how to handle these formated table data objects which appear to be internal to the PS host.

Would be great if someone can clarify

Thanks
Reply With Quote
  #4 (permalink)  
Old October 8th, 2009, 03:57 AM
Registered User
 
Join Date: Oct 2009
Location: China
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to amandaboard Send a message via Skype™ to amandaboard
Default Optical Mark Reader Scanner

NANHAO Optical Mark Reader (OMR Scanner) is a high speed data capture device which is mainly used for recognizing the filled datas in all kind of info-Forms. Itís highest reading speed can reach nearly 8000 info-Forms per hour (A4)
NANHAO Optical Mark Reader (OMR Scanner) has been largely used in all kind areas of high speed data processing, such as school examination, vote, transportation, human resources, fiscal taxation and finance and so on.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recursive Query for Formatted Output Itech SQL Server 2005 11 June 12th, 2008 04:32 PM
Hosted Form of Component angelboy C# 2005 7 March 31st, 2008 02:36 PM
Hosted BeerHouse and sub directory gb012993 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 January 16th, 2008 12:48 AM
Events with IIS hosted remoting koraykazgan C# 1 May 1st, 2007 03:49 PM
Moving App to Hosted site dthoma128 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 13 December 19th, 2006 02:59 PM



All times are GMT -4. The time now is 05:51 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.