include noteproperty in output with select-object

https://powershell.org/forums/topic/include-noteproperty-in-output-with-select-object/

$object | get-member says:

displayname property
id property
[Microsoft.Windows.Computer].PrincipalName noteproperty

how do i get to that principalname with a select-object or a where-object? these three are not doing it:

$object | select [Microsoft.Windows.Computer].PrincipalName
$object | select PrincipalName
$object | select @{label=‘principalname’;expression={$_.[Microsoft.Windows.Computer].PrincipalName} }

You may show a little bit more of the code you’re using to create the $object.

And please format you code as code using the code tag button (pre). Thanks.

Select-Object doesn’t know how to parse a property name like that. But you can use the object property access operator (.) to get the value.

$object.‘[Microsoft.Windows.Computer].PrincipalName’

$object | select @{l=‘PrincipalName’; e={$_.‘[Microsoft.Windows.Computer].PrincipalName’}}

 

thank you Sean. i was missing the single quotes around ‘[Microsoft.Windows.Computer].PrincipalName’.