• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 451
  • Last Modified:

C# equivalent of powershell format-custom ?

Hi,

Is there an equivalent of the format-custom command. So the format looks very much like the original class / object in the source code.

I would like to use this for WMI objects but would hope it can be used for other objects as we'll.

thanks,

Ward
0
whorsfall
Asked:
whorsfall
  • 2
1 Solution
 
Bob LearnedCommented:
I don't believe that there is an equivalent, but where are you trying to use this?  In other words, what is the "bigger picture"?
0
 
whorsfallAuthor Commented:
Hi,

Thanks for your response. Basically I am trying to output a WMI object
to a textbox for a UI I am writing and I like the quick way it formats all
the output.

Saves me writing a number of lines of code - to format the output.

The thinking I had was that since powershell is tied closely to .NET
I thought there might be a method call to do it.

Thanks,

Ward.
0
 
Bob LearnedCommented:
Powershell may or may not use .NET components, so it is difficult to know for specific commands.  It would be an interesting challenge to try to find something.  I doubt, though, that there is anything to find.
0
 
RobOwner (Aidellio)Commented:
Yeah I can't see how you could do it either.  The formatting would be internal to powershell and it would basically format the data based on parameters you specify.  
It may take you just as long to code a generic class to format output based on a WMI input object than it would to trawl the web and testing sample code to get something you want.
You could always utilize powershell from your app but I see that as counter-productive.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now