I am developing a Powershell Cmdlet using C#, and I was wondering if there's a way of controlling the formatting of the objects I write to Powershell in the Cmdlet itself. Basically, I have objects with too many properties to display easily on the screen, and my Cmdlet is sending those to Powershell with WriteObject()
I would like users of my cmdlets to be able to run them and, in the Powershell console, read the data returned as they would have done using the command prompt. Unfortunately, the number of properties Powershell is trying to fit in columns means most are truncated, and when I add more it gives each property its own line which is worse.
I've seen things which allow the user to format the data appropriately, but nothing that allows the developer to set a default. Basically what I want is something like an Attribute I can apply to each property of the objects being pumped through to Powershell which tells Powershell whether to display each property or not (assuming the user has set no other formatting options).
(I've tried making them public fields instead of properties too, and Powershell still shows them)