I am developing a Powershell cmdlet using C #, and I was wondering if there is a way to control the formatting of the objects that I write in Powershell in Cmdlet itself. Basically, I have objects with too many properties that can be easily displayed on the screen, and my cmdlet sends them to Powershell using WriteObject()
I want users of my cmdlets to be able to run them, and in the Powershell console, read the data returned as they would by the command line. Unfortunately, the number of Powershell properties that try to fit into the columns means that most of them are truncated, and when I add more, this gives each property its own row, which is worse.
I have seen things that allow the user to format the data correctly, but nothing allows the developer to set a default value. Basically what I want is something like an attribute that I can apply to every property of objects that are pumped to Powershell, which tells Powershell whether to show each property or not (unless the user has set other formatting options).
(I tried to make them public fields instead of properties, too, and Powershell still shows them)
source share