formats/adgroupreport.format.ps1xml

<?xml version="1.0" encoding="utf-8"?>
<Configuration>
  <ViewDefinitions>
    <View>
      <Name>ADGroupReport</Name>
      <ViewSelectedBy>
        <TypeName>ADGroupReport</TypeName>
      </ViewSelectedBy>
      <CustomControl>
        <CustomEntries>
          <CustomEntry>
            <CustomItem>
              <Text>Name : </Text>
              <ExpressionBinding>
                <PropertyName>DistinguishedName</PropertyName>
              </ExpressionBinding>
              <Text> [</Text>
              <ExpressionBinding>
                   <ScriptBlock>
                  if ($host.name -match 'console' -AND $_.Scope -eq 'Universal') {
                      "$($ADReportingToolsOptions.Universal)$($_.Scope)$([char]0x1b)[0m"
                      }
                elseif ($host.name -match 'console' -AND $_.Scope -eq 'DomainLocal') {
                      "$($ADReportingToolsOptions.DomainLocal)$($_.Scope)$([char]0x1b)[0m"
                      }
                      else {
                      $_.Scope
                      }
                  </ScriptBlock>
              </ExpressionBinding>
              <Text>|</Text>
              <ExpressionBinding>
                <ScriptBlock>
                  if ($host.name -match 'console' -AND $_.Category -eq 'Distribution') {
                      "$($ADReportingToolsOptions.DistributionList)$($_.Category)$([char]0x1b)[0m"
                      }
                      else {
                      $_.Category
                      }
                  </ScriptBlock>
              </ExpressionBinding>
              <Text>]</Text>
              <NewLine />
              <Text>ManagedBy : </Text>
              <ExpressionBinding>
                <PropertyName>ManagedBy</PropertyName>
              </ExpressionBinding>
              <NewLine />
              <Text>Description : </Text>
              <ExpressionBinding>
                <PropertyName>Description</PropertyName>
              </ExpressionBinding>
              <NewLine />
              <ExpressionBinding>
                <!-- Insert a horizontal line-->
                <ScriptBlock>
                    $line = "_"*($host.ui.RawUI.WindowSize.Width-10)
                    $line
                </ScriptBlock>
              </ExpressionBinding>
              <NewLine />
              <Frame>
                <LeftIndent>4</LeftIndent>
                <CustomItem>
                  <Text>
                  </Text>
                  <ExpressionBinding>
                    <ScriptBlock>
                      <!-- show disabled accounts with a red name-->
                      $_.members | Select-Object DisplayName,Name,Description,
                      @{Name="DistinguishedName"; Expression={
                          if ($host.name -match "console" -AND (-Not ($_.Enabled))) {
                          "$($ADReportingToolsOptions.alert)$($_.DistinguishedName)$([char]0x1b)[0m"
                          }
                          else {
                              $_.DistinguishedName
                          }
                      }}| Out-String
                      </ScriptBlock>
                  </ExpressionBinding>
                </CustomItem>
              </Frame>
            </CustomItem>
          </CustomEntry>
        </CustomEntries>
      </CustomControl>
    </View>
    <View>
      <!--Created 03/16/2021 10:17:57 by COMPANY\artd-->
      <Name>age</Name>
      <ViewSelectedBy>
        <TypeName>ADGroupReport</TypeName>
      </ViewSelectedBy>
      <TableControl>
        <!--Delete the AutoSize node if you want to use the defined widths.
        <AutoSize />-->
        <TableHeaders>
          <TableColumnHeader>
            <Label>Name</Label>
            <Width>20</Width>
            <Alignment>left</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Members</Label>
            <Width>7</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Created</Label>
            <Width>23</Width>
            <Alignment>left</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Modified</Label>
            <Width>23</Width>
            <Alignment>left</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Age</Label>
            <Width>15</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <TableColumnItems>
              <TableColumnItem>
                <ScriptBlock>
                if ($host.name -match "Console" -AND $_.Category -eq "Distribution") {
                    "$($ADReportingToolsOptions.DistributionList)$($_.Name)$([char]0x1b)[0m"
                }
                else {
                $_.Name
                }
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                if ($host.name -match "Console" -AND $_.membercount -eq 0) {
                    "$($ADReportingToolsOptions.alert)$($_.MemberCount)$([char]0x1b)[0m"
                }
                else {
                $_.MemberCount
                }
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Created</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Modified</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>$_.Age.ToString() -replace "\.\d+$",""</ScriptBlock>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
  </ViewDefinitions>
</Configuration>