Remove-Member¶
SYNOPSIS¶
Removes specified members (properties) from an object.
SYNTAX¶
Remove-Member [-InputObject] <Object> [-Name] <String[]> [-PassThru] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
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: Object
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Name¶
Specify one or more member names to remove.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PassThru¶
When specified, output the modified object.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction¶
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS¶
OUTPUTS¶
PSCustomObject¶
NOTES¶
The modified object without the specified properties, if -PassThru is used.