Add-Member
Use Add-Member to add a property or method to an existing object — the key to shaping custom output in reports and pipeline results.
Documentation: Microsoft Learn — add-member
Syntax
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Examples
Add a simple note property
Show reference output
Illustrative output · values vary by environment
24 October 2026 19:10:00
Add a calculated property that updates itself
Show reference output
Illustrative output · values vary by environment
42.18
Add the same property to every object in a pipeline
Show reference output
Illustrative output · values vary by environment
Name Environment ---- ----------- Spooler Production WinRM Production W32Time Production
Parameters
Parameter definitions:
-MemberType— The kind of member: NoteProperty, ScriptProperty, AliasProperty, ScriptMethod, CodeMethod, or PropertySet.-Name— The name of the new property or method.-Value— For NoteProperty, the value. For ScriptProperty, a script block that runs when the property is read.-SecondValue— For AliasProperty, the real property name it points to.-Force— Overwrites an existing member with the same name instead of throwing an error.-PassThru— Returns the modified object so it can continue down the pipeline.
Add-Member changes the object, not the pipeline
Without -PassThru, Add-Member modifies the object in place and outputs nothing, so a pipeline after it receives nothing. When you pipe into Add-Member and want objects to keep flowing, always add -PassThru.
For building a brand-new object from scratch, [pscustomobject]@{ Name = 'x'; Value = 1 } is cleaner and faster than New-Object PSObject plus several Add-Member calls. Reserve Add-Member for enriching objects that already exist, such as service or process objects.
Script properties run their script block every time the property is read, and $this inside the block refers to the object itself. That makes them ideal for computed values like free-space percentages, but expensive if the calculation is slow and the property is read often.
Inspect an object's members with Get-Member
Shape output with Select-Object
Updated 25 October 2026. Browser outputs are fictional; check the installed module help for your environment.
Recap
Add-Member Use Add-Member to add a property or method to an existing object — the key to shaping custom output in reports and pipeline results.
Next: New Object