You are here: > PowerShell > PowerShell 1.0 > Add-Member
ActiveXperts Network Monitor 2015 proactively manages network servers, devices, databases and more.

Add-Member - PowerShell 1.0

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Back up your Hyper-V VMs Easy & Fast. 100% built for Hyper-V. Free for 2 VMs, forever.


-memberType PSMemberType
        The type of the member to add. Valid values for this are:
        {AliasProperty | CodeProperty| Property | NoteProperty | ScriptProperty
       | Properties | PropertySet | Method | CodeMethod | ScriptMethod | Methods
       | ParameterizedProperty | MemberSet | All}

   -inputObject psobject
        The object to which the new member is added. (Required)
        Enter a variable that contains the objects or type a command or 
        expression that gets the objects.

   -name string
        The name of the member to be added.

   -value Object
        The initial value of the added member. If you add an AliasProperty,
        CodeProperty or CodeMethod member, you can supply optional, addi
        tional information by using the -SecondValue parameter.

   -force SwitchParameter
        Adds a new member even if one with the same name already exists. Does not
        work for core members of a type.

   -passThru SwitchParameter
        Pass the newly-extended object created by this cmdlet along the pipeline.

        Supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable.

Add a note property to a DirectoryInfo object returned by Get -ChildItem.

PS C:>$a = (get-childitem)[0]
$a | add-member -membertype noteproperty -name MyNote -value SomeSampleText
$a | get-member

The above names a new property MyNote and assigns it the value: SomeSampleText.
Piping the updated object to Get-Member demonstrates that the property has been added.
For more examples run get-help Add-Member -detailed