__ComObject formatting

This topic contains 3 replies, has 3 voices, and was last updated by  Richard Siddaway 4 years, 1 month ago.

  • Author
    Posts
  • #10780

    William Kempf
    Participant

    Is it possible to use a ps1xml format specification to format specific COM object types? I've tried searching but the closest I've found was extending the base System.__ComObject type to add functionality. I want to format a specific COM type.

  • #10782

    Don Jones
    Keymaster

    Huh. I've never tried. In theory, if it shows a TypeName when you pipe the object to Get-Member, then you should be able to build a view on it. But without trying it, I can't say for sure.

  • #10783

    William Kempf
    Participant

    Ah... I think I see how to do it. System.__ComObject isn't enough. Get-Member shows TypeName as System.__ComObject#{Guid}, and that's what I need to use. A quick test shows this to be the case. Stupid question, so thanks for helping me think about it more intelligently and arriving at the answer :).

  • #10789

    Richard Siddaway
    Moderator

    In many cases the COM object is embedded in the returned object so you will need to unravel that to get to the point of being able to format the COM object. I would certainly think about the return on doing this – is it worth the effort?

You must be logged in to reply to this topic.