Skip to content

Remove-Member

SYNOPSIS

Removes specified members (properties) from an object.

SYNTAX

__AllParameterSets

Remove-Member [-InputObject] <Object> [-Name] <string[]> [-PassThru] [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

The Remove-Member function removes specified members (properties) from objects passed through the pipeline. If the specified properties exist, they are removed; otherwise, a verbose message is displayed. When the -PassThru switch is used, the modified object is returned.

EXAMPLES

EXAMPLE 1

$obj = [PSCustomObject]@{Name="John"; Age=30; City="New York"} $obj | Remove-Member -Name "Age" -PassThru

Output:

Name  City
----  ----
John  New York

Removes the "Age" property from the PSCustomObject and returns the modified object.

PARAMETERS

-InputObject

Accept input from the pipeline.

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Name

Specify one or more member names to remove.

Type: System.String[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-PassThru

When specified, output the modified object.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.Object

{{ Fill in the Description }}

OUTPUTS

PSCustomObject

{{ Fill in the Description }}

NOTES

The modified object without the specified properties, if -PassThru is used.