Finding out what determines which properties are displayed

PowerShell Team

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]

[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]

PSMDTAG:FAQ: Why are only a subset of properties displayed?

PSMDTAG:TYPE:WMI: Win32_PageFileUsage

PSMDTAG:CMDLET: Trace-Command, Get-WMIObject

PSMDTAG:INTERNAL: Use Trace-Command to find out what decisions FORMATTING is making.

PSMDTAG:CMDLET:FORMAT: Debugging formatting decisions

0 comments

Discussion is closed.

Feedback usabilla icon