formats/adbranchmember.format.ps1xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
Format type data generated 02/24/2021 15:39:43 by COMPANY\artd
 
This file was created using the New-PSFormatXML command that is part
of the PSScriptTools module.
https://github.com/jdhitsolutions/PSScriptTools
-->
<Configuration>
  <ViewDefinitions>
    <View>
      <Name>default</Name>
      <ViewSelectedBy>
        <TypeName>ADBranchMember</TypeName>
      </ViewSelectedBy>
      <GroupBy>
        <ScriptBlock>
        <!-- A Switch statement doesn't work in this kind of file-->
        If ($host.name -match "console" -AND $_.Class -eq 'User') {
            $c= "$($ADReportingToolsOptions.UserClass)$($_.Class)$([char]0x1b)[0m"
          }
        elseif ($host.name -match "console" -AND $_.class -eq 'Computer') {
            $c= "$($ADReportingToolsOptions.ComputerClass)$($_.Class)$([char]0x1b)[0m"
          }
        elseif ($host.name -match "console" -AND $_.class -eq 'Group') {
            $c= "$($ADReportingToolsOptions.GroupClass)$($_.Class)$([char]0x1b)[0m"
          }
        else {
          $c = $_.class
          }
        "{0} [{1}]" -f $_.parent,$c
        </ScriptBlock>
        <Label>Branch</Label>
      </GroupBy>
      <TableControl>
        <!--Delete the AutoSize node if you want to use the defined widths
        <AutoSize />.-->
        <TableHeaders>
          <TableColumnHeader>
            <Label>DistinguishedName</Label>
            <Width>55</Width>
            <Alignment>left</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Name</Label>
            <Width>15</Width>
            <Alignment>left</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Description</Label>
            <Width>30</Width>
            <Alignment>left</Alignment>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <Wrap />
            <TableColumnItems>
              <TableColumnItem>
                <ScriptBlock>
                if ($host.name -match 'Console' -AND (-Not $_.Enabled)) {
                  "$($ADReportingToolsOptions.alert)$($_.DistinguishedName)$([char]0x1b)[0m"
                }
                else {
                  $_.DistinguishedName
                }
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Name</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Description</PropertyName>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
  </ViewDefinitions>
</Configuration>