I have an array with psocustomobjet like this :
$Data=@()
$Data += [PSCustomObject]@{
'RawMessage' = '123'
'MessageType' = 'String'
'Export' = ''}
$Data += [PSCustomObject]@{
'RawMessage' = '456'
'MessageType' = 'File'
'Export' = ''}
$Data += [PSCustomObject]@{
'RawMessage' = '789'
'MessageType' = 'String'
'Export' = ''}
If column "export" is empty, I would like to remove it to get the following result :
RawMessage MessageType
---------- -----------
123 String
456 File
789 String
My control seem good but I didn't manage to remove the column :
If ($Data.Export -NotLike $Null) {$Data.PSObject.Properties.Remove('Export')}
I tried a lot of commands but I keep with my column...
Thank for your help.