Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7657501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:02:53+00:00 2026-05-31T13:02:53+00:00

I am developing a Powershell Cmdlet using C#, and I was wondering if there’s

  • 0

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)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:02:55+00:00Added an answer on May 31, 2026 at 1:02 pm

    I’m assuming you’re using PowerShell 2.0.

    If your module is called MyModule, you can create a MyModule.Format.ps1xml file alongside it to describe what properties are displayed by default by Format-List, Format-Table, etc. See Get-Help about_Format.ps1xml and Formatting File Overview for more information.

    To link your formatting file to your module, you would create a module manifest and define the FormatsToProcess item. The New-ModuleManifest cmdlet can get you started with this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Developing server side code i finally got my eyes X-crossed trying to write -
Developing a project of mine I realize I have a need for some level
developing iphone app, I have used a UIImageview and i have set an image
Developing for iPhone, I have a collection of points that I need to make
We're developing in Java for the most, but we want to integration test (using
Developing a network application, I have a Connection class that manages sending and receiving
I am currently developing an application in C# (.NET 4.0) that should have as
Developing for OpenGL ES, so no access to glut or glu. I'm wondering what
I'm developing a powershell snapin derived from PSSnapIn . If I manually copy my
I'm developing an application in PowerShell. I am storing variables in a hashtable. How

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.