[MSH] System.Guid output is not formatted as a readable string (bug/suggestion filed)

Discussion in 'Scripting' started by Alex K. Angelopoulos [MVP], Apr 9, 2006.

  1. Alex K. Angelopoulos [MVP], Apr 9, 2006
    #1
    1. Advertisements

  2. Yep seems to be an oversight so I voted on it. For now, as you probably
    already know, you could create a file called Guid.mshxml with this in it:

    <Types>
    <Type>
    <Name>System.Guid</Name>
    <Members>
    <ScriptProperty>
    <Name>Guid</Name>
    <GetScriptBlock>$this.ToString()</GetScriptBlock>
    </ScriptProperty>
    </Members>
    </Type>
    </Types>

    and then execute "update-typeData -appendpath <path_to_Guid.mshxml>" and
    then you would get:

    MSH:82 # $guid

    Guid
     
    Keith Hill [MVP], Apr 9, 2006
    #2
    1. Advertisements

  3. Update-TypeData is for you to add NoteProperty, ScriptProperty etc to a
    type, while Update-FormatData allows you to define which properties you
    want to display and how you want to display them in format-* cmdets.
    In the case of Guid, you defined a scriptproperty in guid.msh1xml, and it
    will be formatted without any definition in *.format.msh1xml files.

    --
    Wei Wu [MSFT]
    MSH Team
    Microsoft Corporation
    This posting is provided "AS IS" with no warranties, and confers no rights.

     
    Wei Wu [MSFT], Apr 9, 2006
    #3
  4. Ah. Type extension versus display format. Seems obvious now that you
    describe them together. :)

    "Wei Wu [MSFT]" wrote in message
    news:uBM9Io$...
     
    Alex K. Angelopoulos [MVP], Apr 9, 2006
    #4
  5. Thanks!
     
    Keith Hill [MVP], Apr 9, 2006
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.