I want to create new instance of my custom PSObject. I have a Button object created as PSObject and I want to create new object Button2 which has the same members as Button
Another possibility:
$o1 = New-Object PsObject -Property @{ prop1='a' ; prop2='b' } $o2 = $o1 | select * $o2.prop1 = 'newvalue' $o1.prop1 $o2.prop1 a newvalue