다음을 통해 공유


Finding out what determines which properties are displayed

MoW, a Monad newsgroup regular, asked why only the Caption, Name and PeakUsage properties were displayed from the command “get-WMIObject Win32_PageFileUsage” while the output object had a lot more properties. I think it is worth it to explain in details how to find out which properties are displayed.
First, I would look at which view defined in one of the *.format.msh1xml files is used. The Trace-Command Cmdlet can help here:
Trace-Command –option All –Name FormatViewBinding { get-WMIObject Win32_PageFileUsage | out-host} –MshHost

The trace output is in yellow. It reads at the end: “DEBUG: FormatViewBindin Information: 0 : No applicable view has been found.” Now, I know that no view is used. The next place to look is the types.msh1xml file. In this file, each type description can have a node called DefaultDisplayPropertySet where the default display properties are defined. Since the class in question is Win32_PageFileUsage, we can search for the string in notepad. Here is the section for the class.

    <Type>
        <Name>System.Management.ManagementObject#root\cimv2\Win32_PageFileUsage</Name>
        <Members>
            <PropertySet>
                <Name>MshStatus</Name>
                <ReferencedProperties>
                    <Name>Status</Name>
                    <Name>Name</Name>
                    <Name>CurrentUsage</Name>
                </ReferencedProperties>
            </PropertySet>
            <MemberSet>
                <Name>MshStandardMembers</Name>
                <Members>
                    <PropertySet>
<Name>DefaultDisplayPropertySet</Name>
<ReferencedProperties>
<Name>Caption</Name>
<Name>Name</Name>
<Name>PeakUsage</Name>
</ReferencedProperties>
</PropertySet>

                </Members>
            </MemberSet>
        </Members>
    </Type>

Under the DefaultDisplayPropertySet node, there are Caption, Name, and PeakUsage. The question is answered.

- Kevin[MSFT]

Comments

  • Anonymous
    March 23, 2006
    as I wanted a list of defined defaults, I came to this one-liner :

    ([xml](gc $MSHHOMEtypes.mshxml)).types.type | foreach {"n$($_.name.split('#')[1])n";$.members.memberset.members.PropertySet.ReferencedProperties | foreach {$.name}}

    it will display the wmi classes where defaults are defined, and wich properties are selected.

    there is a bit of garbage at the begin and end of the file I think it's a handy list.

    Greetings //o//
  • Anonymous
    March 23, 2006
    why not the win32_processor?
    He had a DefaultDisplayPropertySet.But not show only about it.
    ----------------
    study mow:
    ([xml](gc $MSHHOMEtypes.mshxml)).types.type | where-object {$.name.startswith("System.Management.ManagementObjec") } | select-object @{expression = {$.name.split('#')[1].split('')[2]};name="name"}, @{e={$.members.memberset.members.propertyset.referencedproperties | foreach { $.name}};name="properties"}
  • Anonymous
    March 25, 2006
    trace-expression?
  • Anonymous
    March 30, 2006
    In out most recent build, trace-expression is renamed to trace-command.
    -Kevin[MSFT]