Solved

C# equivalent of powershell format-custom ?

Posted on 2013-10-25
4
432 Views
Last Modified: 2013-11-16
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
Comment
Question by:whorsfall
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39602664
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
 

Author Comment

by:whorsfall
ID: 39603415
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39603836
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
 
LVL 42

Accepted Solution

by:
Rob Jurd, EE MVE earned 500 total points
ID: 39605228
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
I have purchased two new systems and both are now Universal Extensible Firmware Interface (UEFI) based. UEFI is replacing BIOS for the desktop PC. It is a Linux based firmware with enough robustness it can communicate with a website without loading …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now