PowerShell Objects Are .NET Objects
Every value that a PowerShell cmdlet returns is an instance of a real .NET type, complete with a type name, a set of properties, and often methods you can call. What you see printed to the console is only a default text rendering of that object; the object itself carries far more data than what's displayed, and that hidden data is exactly what later pipeline stages can query.
Cricket analogy: A player's scorecard entry isn't just a number — it's an object with runs, balls faced, strike rate and dismissal type bundled together, exactly like a PowerShell object carrying properties beyond its printed text.
Discovering Properties and Methods with Get-Member
The Get-Member cmdlet, often abbreviated gm, reveals the full shape of any object piped into it: its TypeName, every Property with its data type, and every Method you can call, including ones never shown in the default console output. This makes Get-Member the single most useful discovery tool when working with an unfamiliar cmdlet's output.
Cricket analogy: Get-Member is like pulling up a player's full profile on a cricket stats app — batting average, bowling figures, fielding stats — instead of just seeing their name on the scoreboard.
Get-Process | Get-Member -MemberType Property
# Inspect a single object's real type
Get-Process | Select-Object -First 1 | Get-Member | Select-Object -First 1 TypeNameAccessing Properties and Calling Methods
Dot notation reads a property or invokes a method on an object: $process.ProcessName returns a stored value directly, while $process.Kill() performs an action that changes the state of the system. The parentheses matter — omitting them on a method just returns a description of the method rather than executing it — and inside pipeline script blocks the same dot notation is used on $_, as in $_.Status.
Cricket analogy: Writing $player.Average is like flipping straight to a specific stat on a player's profile page, while $player.CalculateStrikeRate() is like asking the system to compute a new figure on demand.
Every object's default console output is produced by calling its .ToString() method or a matching .ps1xml view, which can hide most of the object's actual data. Never assume an object only has what you see printed — always check with Get-Member first.
Creating Custom Objects
The [PSCustomObject] type accelerator, combined with a hashtable literal, is the standard way to build your own structured objects from scratch, letting you define exactly which named properties should exist in a fixed order. This is the preferred technique for producing clean report rows or combining data pulled from several different sources into one consistent shape.
Cricket analogy: Building a [PSCustomObject] is like a scorer manually creating a new stat line for an unlisted player — you define exactly which fields (Runs, Overs, Wickets) belong on that card.
Building objects with New-Object PSObject and then Add-Member for each field is far slower and more verbose than [PSCustomObject]@{ Name = 'Value' }. Reserve the older Add-Member approach for cases where you need to attach a property to an existing object after the fact.
- Every PowerShell output value is a typed .NET object, not just displayed text.
Get-Member(gm) lists an object's real TypeName, properties, and methods.- Dot notation reads a property directly; calling a method with
()performs an action. - The console's default view is only a rendering — objects usually carry more data than is shown.
[PSCustomObject]@{ ... }is the standard, fast way to build your own structured objects.- Prefer
[PSCustomObject]overNew-ObjectplusAdd-Memberfor new objects.
Practice what you learned
1. What does Get-Member reveal about a piped-in object?
2. What is the difference between `$obj.Kill` and `$obj.Kill()`?
3. Which syntax is the preferred, efficient way to build a new custom object in modern PowerShell?
4. Why can two objects look identical when printed to the console but behave differently in a script?
Was this page helpful?
You May Also Like
The PowerShell Pipeline
Learn how PowerShell chains cmdlets together by passing live .NET objects from one stage to the next, instead of parsing plain text like traditional shells.
Filtering and Selecting
Master Where-Object for keeping only the rows you need and Select-Object for keeping only the properties you need, plus the operators that power both.
Formatting Output
Learn why PowerShell keeps data and display separate, how to shape output with Format-Table and Format-List, and when to use ConvertTo-* instead.
Related Reading
Related Study Notes in Programming
Browse all study notesApache Spark Study Notes
Programming · 30 topics
ProgrammingApache Flink Study Notes
Programming · 30 topics
ProgrammingHadoop Study Notes
Programming · 30 topics
ProgrammingSnowflake Study Notes
Programming · 30 topics
ProgrammingApache Airflow Study Notes
Programming · 30 topics
Programmingdbt (Data Build Tool) Study Notes
Programming · 30 topics