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

  • Home
  • SEARCH
  • 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 7985351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:31:45+00:00 2026-06-04T11:31:45+00:00

Most of out of the box PowerShell commands are returning complex objects. for example,

  • 0

Most of out of the box PowerShell commands are returning “complex” objects.

for example, Get-Process returns an array of System.Diagnostics.Process.

All of the function I’ve ever wrote was returning either a simple type, or an existing kind of object.

If I want to return a home made objects, what are guidelines ?

For example, imagine I have an object with these attributes: Name, Age. In C# I would have wrote

public class Person {
    public string Name { get; set; }
    public uint Age { get; set; }
}

What are my options for returning such object from a PowerShell function ?

  1. As my goal is to create PowerShell module, should I move to a c# module instead of a ps1 file ?
  2. should I compile such objects in a custom DLL and reference it in my module using LoadWithPartialName ?
  3. Should I put my class in a powershell string, then dynamically compile it ?
  • 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-06-04T11:31:47+00:00Added an answer on June 4, 2026 at 11:31 am

    you can use this syntax:

    New-Object PSObject -Property @{
       Name = 'Bob'
       Age = 32
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to get the most out of working in cch or tcsh
I'm running the Netty 3.3.1 Secure Chat example out of the box and it
I've worked out most of the code and have several game classes. The one
We all know that most applications out there assume class names to follow the
In XCode I am using the interface builder (StoryBoard) to lay out most of
I am trying to figure out the most efficient way to ensure cross-browser compatibility.
I'm trying to figure out the most efficient way to implement RoR-style partials/collections for
I'm trying to figure out the most efficient way to running a pretty hefty
My website sends out html emails but most of my recipients are receiving them
Solution: strpos turned out to be the most efficient. Can be done with substr

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.