I have the following:
$test = [pscustomobject]@{
First = "Donald";
Middle = "Fauntleroy";
Last = "Duck";
Age = 80
}
$test | Get-Member -MemberType NoteProperty | % {"$($_.Name)="}
which prints:
Age= First= Last= Middle=
I would like to extract the value from each property and have it included as the value for my name value pairs so it would look like:
Age=80 First=Donald Last=Duck Middle=Fauntleroy
I am trying to build a string and do not know the property names ahead of time. How do I pull the values to complete my name value pairs?
$prop.Name + "=" + $test.($prop.Name)
– Fonsie