CIMRegistry.format.ps1xml

<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
    <ViewDefinitions>
 
        <View>
          <Name>CIMRegistryKey</Name>
          <ViewSelectedBy>
            <TypeName>CIMRegistryKey</TypeName>
          </ViewSelectedBy>
          <GroupBy>
              <PropertyName>ParentKey</PropertyName>
          </GroupBy>
          <TableControl>
            <TableHeaders>
              <TableColumnHeader>
                <Label>PSComputerName</Label>
              </TableColumnHeader>
              <TableColumnHeader>
                <Label>Key</Label>
              </TableColumnHeader>
              <TableColumnHeader>
                <Label>DefaultValue</Label>
              </TableColumnHeader>
              <TableColumnHeader>
                <Label>SubKeyCount</Label>
              </TableColumnHeader>
              <TableColumnHeader>
                <Label>ValueCount</Label>
              </TableColumnHeader>
            </TableHeaders>
            <TableRowEntries>
              <TableRowEntry>
                <TableColumnItems>
                  <TableColumnItem>
                    <PropertyName>PSComputerName</PropertyName>
                  </TableColumnItem>
                  <TableColumnItem>
                   <PropertyName>Key</PropertyName>
                  </TableColumnItem>
                  <TableColumnItem>
                   <PropertyName>DefaultValue</PropertyName>
                  </TableColumnItem>
                  <TableColumnItem>
                   <!-- <PropertyName>SubKeyCount</PropertyName> -->
                   <ScriptBlock>If ($_.SubKeyCount) {$_.SubKeyCount} Else {If ($_.ErrorCode) {'ERROR'}}</ScriptBlock>
                  </TableColumnItem>
                  <TableColumnItem>
                   <!-- <PropertyName>ValueCount</PropertyName> -->
                   <ScriptBlock>If ($_.ValueCount) {$_.ValueCount} Else {If ($_.ErrorCode) {'ERROR'}}</ScriptBlock>
                  </TableColumnItem>
                </TableColumnItems>
              </TableRowEntry>
            </TableRowEntries>
          </TableControl>
        </View>
 
        <View>
          <Name>CIMRegistryValue</Name>
          <ViewSelectedBy>
            <TypeName>CIMRegistryValue</TypeName>
          </ViewSelectedBy>
          <GroupBy>
              <PropertyName>Path</PropertyName>
          </GroupBy>
          <TableControl>
            <TableHeaders>
              <TableColumnHeader>
                <Label>PSComputerName</Label>
              </TableColumnHeader>
              <TableColumnHeader>
                <Label>ValueName</Label>
              </TableColumnHeader>
              <TableColumnHeader>
                <Label>ValueType</Label>
                <Alignment>center</Alignment>
              </TableColumnHeader>
              <TableColumnHeader>
                <Label>Data</Label>
              </TableColumnHeader>
            </TableHeaders>
            <TableRowEntries>
              <TableRowEntry>
                <TableColumnItems>
                  <TableColumnItem>
                    <PropertyName>PSComputerName</PropertyName>
                  </TableColumnItem>
                  <TableColumnItem>
                   <PropertyName>ValueName</PropertyName>
                  </TableColumnItem>
                  <TableColumnItem>
                    <PropertyName>ValueType</PropertyName>
                  </TableColumnItem>
                  <TableColumnItem>
                    <ScriptBlock>If ($_.ErrorCode) {"(Invalid $($_.ValueType) value)"} Else {$_.Data}</ScriptBlock>
                  </TableColumnItem>
                </TableColumnItems>
              </TableRowEntry>
            </TableRowEntries>
          </TableControl>
        </View>
 
    </ViewDefinitions>
</Configuration>