locked
Where did Object.Psobject go? RRS feed

  • Question

  • I'm simply trying to validate that my object 1. has the properties I want it to have, and 2. that they're all strings before I work on them.  I was using $object.psobject.properties.name and $object.psobject.properties.typenameofvalue and had test it as working, but now none of the noteproperties are listed in there.  If you do an $object | get-member you can still get the noteproperties, but of course the value types are all in Definition in the form of "string Key=Value" which is a pain to get things out of.

    Has anyone hit this?  Any idea why my Psobject is behaving so weirdly?  I can see the BaseObject and ImmediateBaseObject properties, I didn't think you were generally supposed to be able to see those.

    Monday, October 14, 2019 6:36 PM

All replies

  • This works for me. I see only the two NoteProperty members:

    $o = [PSCustomObject]@{
        One = 'String1'
        Two = 'String2'
    }
    $o.psobject.properties.name
    $o.psobject.properties.typenameofvalue


    --- Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)

    Monday, October 14, 2019 6:47 PM
  • Heck, I figured it out.  I'm not getting back objects, I'm getting back ARRAYS of them.  If I examine $object[0].psobject I get what I need.
    Monday, October 14, 2019 6:56 PM
  • Hi,

    I am glad to hear that your issue was successfully resolved. If there is anything else we can do for you, please feel free to post in the forum.

    Best Regards,

    Lee


    Just do it.

    Tuesday, October 15, 2019 2:12 AM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Lee

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, November 8, 2019 1:51 PM