?
Solved

C# equivalent of powershell format-custom ?

Posted on 2013-10-25
4
Medium Priority
?
446 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 43

Accepted Solution

by:
Rob earned 2000 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

Create CentOS 7 Newton Packstack Running Keystone

A bug was filed against RDO for the installation of Keystone v3. This guide is designed to walk you through the configuration for using Keystone v3 with Packstack. You will accomplish this using various repos and the Answers file.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

752 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