formats/FileExtensionInfo.format.ps1xml

<!--
Format type data generated 08/13/2021 12:00:43 by PROSPERO\Jeff

This formats the output from the Get-FileExtensionInfo function

This file was created using the New-PSFormatXML command that is part
of the PSScriptTools module.

https://github.com/jdhitsolutions/PSScriptTools
-->
<Configuration>
  <ViewDefinitions>
    <View>
      <!--Created 08/13/2021 12:00:43 by PROSPERO\Jeff-->
      <Name>default</Name>
      <ViewSelectedBy>
        <TypeName>FileExtensionInfo</TypeName>
      </ViewSelectedBy>
      <GroupBy>
        <!--
            You can also use a scriptblock to define a custom property name.
            You must have a Label tag.
            <ScriptBlock>$_.machinename.ToUpper()</ScriptBlock>
            <Label>Computername</Label>

            Use <Label> to set the displayed value.
        <PropertyName>Path</PropertyName>
-->
        <ScriptBlock> "{0} [{1}]" -f $_.Path,$_.Computername</ScriptBlock>
        <Label>Path</Label>
      </GroupBy>
      <TableControl>
        <!--Delete the AutoSize node if you want to use the defined widths.-->
        <AutoSize />
        <TableHeaders>
          <TableColumnHeader>
            <Label>Extension</Label>
            <Width>12</Width>
            <Alignment>left</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Count</Label>
            <Width>8</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>TotalSize</Label>
            <Width>12</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Smallest</Label>
            <Width>15</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Average</Label>
            <Width>19</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Largest</Label>
            <Width>14</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
        <!-- Display the largest extension with the largest total size in RED using ANSI-->
          <TableRowEntry>
            <TableColumnItems>
              <!--
            By default the entries use property names, but you can replace them with scriptblocks.
            <ScriptBlock>$_.foo /1mb -as [int]</ScriptBlock>
-->
              <TableColumnItem>
                <ScriptBlock>
                  if ($host.name -match "console|code|remote" -AND $_.IsLargest) {
                    "`e[38;5;199m$($_.Extension)`e[0m"
                  }
                  else {
                    $_.Extension
                  }
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                  if ($host.name -match "console|code|remote" -AND $_.IsLargest) {
                    "`e[38;5;199m$($_.Count)`e[0m"
                  }
                  else {
                    $_.Count
                  }
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                  if ($host.name -match "console|code|remote" -AND $_.IsLargest) {
                    "`e[38;5;199m$($_.TotalSize)`e[0m"
                  }
                  else {
                    $_.TotalSize
                  }
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                  if ($host.name -match "console|code|remote" -AND $_.IsLargest) {
                    "`e[38;5;199m$($_.SmallestSize)`e[0m"
                  }
                  else {
                    $_.SmallestSize
                  }
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                $avg = [math]::Round($_.AverageSize,2)
                 if ($host.name -match "console|code|remote" -AND $_.IsLargest) {
                    "`e[38;5;199m$($avg)`e[0m"
                  }
                  else {
                    $avg
                  }
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                  <ScriptBlock>
                  if ($host.name -match "console|code|remote" -AND $_.IsLargest) {
                    "`e[38;5;199m$($_.LargestSize)`e[0m"
                  }
                  else {
                    $_.LargestSize
                  }
                </ScriptBlock>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
    <View>
      <!--Created 08/13/2021 12:39:36 by PROSPERO\Jeff-->
      <Name>TotalKB</Name>
      <ViewSelectedBy>
        <TypeName>FileExtensionInfo</TypeName>
      </ViewSelectedBy>
      <GroupBy>
        <!--
            You can also use a scriptblock to define a custom property name.
            You must have a Label tag.
            <ScriptBlock>$_.machinename.ToUpper()</ScriptBlock>
            <Label>Computername</Label>

            Use <Label> to set the displayed value.
-->
        <PropertyName>Path</PropertyName>
        <Label>Path</Label>
      </GroupBy>
      <TableControl>
        <!--Delete the AutoSize node if you want to use the defined widths.
        <AutoSize />-->
        <TableHeaders>
          <TableColumnHeader>
            <Label>Extension</Label>
            <Width>12</Width>
            <Alignment>left</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Count</Label>
            <Width>8</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>TotalKB</Label>
            <Width>12</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <TableColumnItems>
              <!--
            By default the entries use property names, but you can replace them with scriptblocks.
            <ScriptBlock>$_.foo /1mb -as [int]</ScriptBlock>
-->
              <TableColumnItem>
                <PropertyName>Extension</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Count</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>[math]::Round($_.TotalSize/1KB,2)</ScriptBlock>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
     <View>
      <!--Created 08/13/2021 12:39:36 by PROSPERO\Jeff-->
      <Name>TotalMB</Name>
      <ViewSelectedBy>
        <TypeName>FileExtensionInfo</TypeName>
      </ViewSelectedBy>
      <GroupBy>
        <!--
            You can also use a scriptblock to define a custom property name.
            You must have a Label tag.
            <ScriptBlock>$_.machinename.ToUpper()</ScriptBlock>
            <Label>Computername</Label>

            Use <Label> to set the displayed value.
-->
        <PropertyName>Path</PropertyName>
        <Label>Path</Label>
      </GroupBy>
      <TableControl>
        <!--Delete the AutoSize node if you want to use the defined widths.
        <AutoSize />-->
        <TableHeaders>
          <TableColumnHeader>
            <Label>Extension</Label>
            <Width>12</Width>
            <Alignment>left</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Count</Label>
            <Width>8</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>TotalMB</Label>
            <Width>12</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <TableColumnItems>
              <!--
            By default the entries use property names, but you can replace them with scriptblocks.
            <ScriptBlock>$_.foo /1mb -as [int]</ScriptBlock>
-->
              <TableColumnItem>
                <PropertyName>Extension</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Count</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>[math]::Round($_.TotalSize/1MB,2)</ScriptBlock>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
  </ViewDefinitions>
</Configuration>