NTFSSecurity.format.ps1xml

<?xml version="1.0" encoding="utf-8" ?>
<!--<Configuration xmlns="http://schemas.microsoft.com/PowerShell/FormatData/2007/09">-->
<Configuration>
  <SelectionSets>
    <SelectionSet>
      <Name>FileSystemTypes2</Name>
      <Types>
        <TypeName>Alphaleonis.Win32.Filesystem.DirectoryInfo</TypeName>
        <TypeName>Alphaleonis.Win32.Filesystem.FileInfo</TypeName>
      </Types>
    </SelectionSet>
  </SelectionSets>
  <!-- ################ GLOBAL CONTROL DEFINITIONS ################ -->
  <Controls>
    <Control>
      <Name>SimpleFileSystemGrouping</Name>
      <CustomControl>
        <CustomEntries>
          <CustomEntry>
            <CustomItem>
              <Frame>
                <LeftIndent>4</LeftIndent>
                <CustomItem>
                  <ExpressionBinding>
                    <ScriptBlock>
                      if ($global:tempFullName -ne $_.FullName)
                      {
                      "Path: $($_.FullName) (Inheritance $(if ($_.InheritanceEnabled) { "enabled" } else { "disabled" }))"
                      $global:FullName = $_.FullName
                      }
                    </ScriptBlock>
                  </ExpressionBinding>
                  <NewLine/>
                </CustomItem>
              </Frame>
            </CustomItem>
          </CustomEntry>
        </CustomEntries>
      </CustomControl>
    </Control>
 
    <Control>
      <Name>SimpleFileSystemAccessRule2Grouping</Name>
      <CustomControl>
        <CustomEntries>
          <CustomEntry>
            <CustomItem>
              <Frame>
                <LeftIndent>4</LeftIndent>
                <CustomItem>
                  <ExpressionBinding>
                    <ScriptBlock>
                      if ($global:tempFullName -ne $_.FullName)
                      {
                      "Path: $($_.FullName)"
                      $global:FullName = $_.FullName
                      }
                    </ScriptBlock>
                  </ExpressionBinding>
                  <NewLine/>
                </CustomItem>
              </Frame>
            </CustomItem>
          </CustomEntry>
        </CustomEntries>
      </CustomControl>
    </Control>
 
    <Control>
      <Name>FileSystemTypes2-GroupingFormat</Name>
      <CustomControl>
        <CustomEntries>
          <CustomEntry>
            <CustomItem>
              <Frame>
                <LeftIndent>4</LeftIndent>
                <CustomItem>
                  <Text AssemblyName="System.Management.Automation" BaseName="FileSystemProviderStrings" ResourceId="DirectoryDisplayGrouping"/>
                  <ExpressionBinding>
                    <ScriptBlock>
                      Split-Path -Path $_.FullName -Parent
                    </ScriptBlock>
                  </ExpressionBinding>
                  <NewLine/>
                </CustomItem>
              </Frame>
            </CustomItem>
          </CustomEntry>
        </CustomEntries>
      </CustomControl>
    </Control>
  </Controls>
 
  <!-- ################ VIEW DEFINITIONS ################ -->
 
  <ViewDefinitions>
    <View>
      <Name>Security2.FileSystemAccessRule2</Name>
      <ViewSelectedBy>
        <TypeName>Security2.FileSystemAccessRule2</TypeName>
      </ViewSelectedBy>
      <GroupBy>
        <PropertyName>FullName</PropertyName>
        <CustomControlName>SimpleFileSystemGrouping</CustomControlName>
      </GroupBy>
      <TableControl>
        <TableHeaders>
          <TableColumnHeader>
            <Width>35</Width>
            <Label>Account</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Access Rights</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Width>25</Width>
            <Label>Applies to</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Type</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>IsInherited</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>InheritedFrom</Label>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <TableColumnItems>
              <TableColumnItem>
                <ScriptBlock>
                  if ((Get-Module NTFSSecurity).PrivateData.ShowAccountSid)
                  {
                  '{0} ({1})' -f $_.Account.AccountName, $_.Account.Sid
                  }
                  else
                  {
                  $_.Account.ToString()
                  }
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>AccessRights</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                  [Security2.FileSystemSecurity2]::ConvertToApplyTo($_.InheritanceFlags, $_.PropagationFlags)
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>AccessControlType</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>IsInherited</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>InheritedFrom</PropertyName>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
 
    <View>
      <Name>Security2.FileSystemAuditRule2</Name>
      <ViewSelectedBy>
        <TypeName>Security2.FileSystemAuditRule2</TypeName>
      </ViewSelectedBy>
      <GroupBy>
        <PropertyName>FullName</PropertyName>
        <CustomControlName>SimpleFileSystemGrouping</CustomControlName>
      </GroupBy>
      <TableControl>
        <TableHeaders>
          <TableColumnHeader>
            <Width>35</Width>
            <Label>Account</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Access Rights</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Width>25</Width>
            <Label>Applies to</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Type</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>IsInherited</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>InheritedFrom</Label>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <TableColumnItems>
              <TableColumnItem>
                <ScriptBlock>
                  if ((Get-Module NTFSSecurity).PrivateData.ShowAccountSid)
                  {
                  '{0} ({1})' -f $_.Account.AccountName, $_.Account.Sid
                  }
                  else
                  {
                  $_.Account.ToString()
                  }
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>AccessRights</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                  [Security2.FileSystemSecurity2]::ConvertToApplyTo($_.InheritanceFlags, $_.PropagationFlags)
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>AuditFlags</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>IsInherited</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>InheritedFrom</PropertyName>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
 
    <View>
      <Name>Security2.SimpleFileSystemAuditRule2</Name>
      <ViewSelectedBy>
        <TypeName>Security2.SimpleFileSystemAuditRule2</TypeName>
      </ViewSelectedBy>
      <GroupBy>
        <PropertyName>FullName</PropertyName>
        <CustomControlName>SimpleFileSystemGrouping</CustomControlName>
      </GroupBy>
      <TableControl>
        <TableHeaders>
          <TableColumnHeader>
            <Width>35</Width>
            <Label>Account</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Access Rights</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Width>25</Width>
            <Label>Applies to</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Type</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>IsInherited</Label>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <Wrap/>
            <TableColumnItems>
              <TableColumnItem>
                <ScriptBlock>
                  if ((Get-Module NTFSSecurity).PrivateData.ShowAccountSid)
                  {
                  '{0} ({1})' -f $_.Account.AccountName, $_.Account.Sid
                  }
                  else
                  {
                  $_.Account.ToString()
                  }
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>AccessRights</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                  [Security2.FileSystemSecurity2]::ConvertToApplyTo($_.InheritanceFlags, $_.PropagationFlags)
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>AuditFlags</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>IsInherited</PropertyName>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
 
    <View>
      <Name>Security2.FileSystemEffectivePermissionEntry</Name>
      <ViewSelectedBy>
        <TypeName>Security2.FileSystemEffectivePermissionEntry</TypeName>
      </ViewSelectedBy>
      <TableControl>
        <AutoSize/>
        <TableHeaders>
          <TableColumnHeader>
            <Label>Name</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Access</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>AccessMask</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Account</Label>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <TableColumnItems>
              <TableColumnItem>
                <PropertyName>Name</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>AccessAsString</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>AccessMask</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                  if ((Get-Module NTFSSecurity).PrivateData.ShowAccountSid)
                  {
                  '{0} ({1})' -f $_.Account.AccountName, $_.Account.Sid
                  }
                  else
                  {
                  $_.Account.ToString()
                  }
                </ScriptBlock>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
 
    <View>
      <Name>Security2.FileSystemInheritanceInfo</Name>
      <ViewSelectedBy>
        <TypeName>Security2.FileSystemInheritanceInfo</TypeName>
      </ViewSelectedBy>
      <TableControl>
        <AutoSize/>
        <TableHeaders>
          <TableColumnHeader>
            <Label>Name</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>AccessInheritanceEnabled</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>AuditInheritanceEnabled</Label>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <TableColumnItems>
              <TableColumnItem>
                <PropertyName>Name</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>AccessInheritanceEnabled</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>AuditInheritanceEnabled</PropertyName>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
 
    <View>
      <Name>Children2</Name>
      <ViewSelectedBy>
        <SelectionSetName>FileSystemTypes2</SelectionSetName>
      </ViewSelectedBy>
      <GroupBy>
        <ScriptBlock>if ($_.DirectoryName) { $_.DirectoryName } else { $_.Parent.FullName }</ScriptBlock>
        <CustomControlName>FileSystemTypes2-GroupingFormat</CustomControlName>
      </GroupBy>
      <TableControl>
        <TableHeaders>
          <TableColumnHeader>
            <Label>Mode</Label>
            <Width>7</Width>
            <Alignment>left</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Inherits</Label>
            <Width>8</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>LastWriteTime</Label>
            <Width>25</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Size(M)</Label>
            <Width>15</Width>
            <Alignment>right</Alignment>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Name</Label>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <Wrap/>
            <TableColumnItems>
              <TableColumnItem>
                <PropertyName>Mode</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                  !$_.IsInheritanceBlocked
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                  [String]::Format("{0,10} {1,8}", $_.LastWriteTime.ToString("d"), $_.LastWriteTime.ToString("t"))
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                  if ($_ -is [Alphaleonis.Win32.Filesystem.FileInfo])
                  {
                  [Math]::Round($_.Length / 1MB, 2).ToString()
                  }
                  else
                  {
                  " {0,-13}" -f "&lt;DIR&gt;"
                  }
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Name</PropertyName>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
  </ViewDefinitions>
</Configuration>