janhoedt
asked on
Powershell: add noteproperty to customobject
Hi,
I have a Powershell object Selected.System.Management .Automatio n.PSCustom Object
to which I would like to add a noteproperty so I can populate it with a foreach
F.e. customobject is fruits
it has noteproperties colour,weight
In another script I d like to add taste noteproperty
How can I do this?
Tried
$Fruits | Add-Member -MemberType NoteProperty -Name Taste -Value VeryGood -Force but then it adds everywhere test wheras I just need the extra Taste.
Please advise
J.
I have a Powershell object Selected.System.Management
to which I would like to add a noteproperty so I can populate it with a foreach
F.e. customobject is fruits
it has noteproperties colour,weight
In another script I d like to add taste noteproperty
How can I do this?
Tried
$Fruits | Add-Member -MemberType NoteProperty -Name Taste -Value VeryGood -Force but then it adds everywhere test wheras I just need the extra Taste.
Please advise
J.
ASKER
Yes.
"wheras I just need the (extra) Taste."
just Taste, nothing else
How is your $Fruits variable defined?
Pardon the pun, but I want to avoid an apples-to-oranges solution.
Pardon the pun, but I want to avoid an apples-to-oranges solution.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is there a difference between "Taste" and "extra Taste"?