Remove a Member from a PowerShell Object?

Select-Object with ExcludeProperty is good for removing a property from a collection of objects.

For removing a property from a single object this method might be more effective:

# new object with properties Test and Foo
$obj = New-Object -TypeName PSObject -Property @{ Test = 1; Foo = 2 }

# remove a property from PSObject.Properties
$obj.PSObject.Properties.Remove('Foo')

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)