PSCerts.format.ps1xml
<?xml version="1.0" encoding="utf-8" ?>
<Configuration> <Controls> <Control> <Name>CertSummaryItem-Header</Name> <CustomControl> <CustomEntries> <CustomEntry> <CustomItem> <ExpressionBinding> <ScriptBlock> "$($PSStyle.Formatting.TableHeader)$($PSStyle.Reverse)$($PSStyle.Bold) $($_.Location.ToString()) $($PSStyle.Reset)" </ScriptBlock> </ExpressionBinding> </CustomItem> </CustomEntry> </CustomEntries> </CustomControl> </Control> </Controls> <ViewDefinitions> <View> <Name>CertAccessRule</Name> <ViewSelectedBy> <TypeName>PSCerts.CertAccessRule</TypeName> </ViewSelectedBy> <TableControl> <TableHeaders> <TableColumnHeader> <Label>Access</Label> <Alignment>Center</Alignment> </TableColumnHeader> <TableColumnHeader> <Label>FileSystemRights</Label> <Alignment>Center</Alignment> </TableColumnHeader> <TableColumnHeader> <Label>Identity</Label> </TableColumnHeader> </TableHeaders> <TableRowEntries> <TableRowEntry> <Wrap/> <TableColumnItems> <TableColumnItem> <ScriptBlock> $okColor = "$([char]0x1b)[38;5;47m" $warnColor = "$([char]0x1b)[38;5;227m" $criticalColor = "$([char]0x1b)[38;5;198m" $resetColor = "$([char]0x1b)[0m" if ($_.AccessType -eq "Allow") { $color = $okColor } else { $color = $criticalColor } "$color$($_.AccessType)$($PSStyle.Reset)" </ScriptBlock> </TableColumnItem> <TableColumnItem> <ScriptBlock>"$($PSStyle.Foreground.BrightCyan)$($_.FileSystemRights)$($PSStyle.Reset)"</ScriptBlock> </TableColumnItem> <TableColumnItem> <PropertyName>Identity</PropertyName> </TableColumnItem> </TableColumnItems> </TableRowEntry> </TableRowEntries> </TableControl> </View> <View> <Name>CertSummaryItem</Name> <ViewSelectedBy> <TypeName>PSCerts.Summary.CertSummaryItem</TypeName> </ViewSelectedBy> <GroupBy> <PropertyName>Location</PropertyName> <CustomControlName>CertSummaryItem-Header</CustomControlName> </GroupBy> <TableControl> <TableHeaders> <TableColumnHeader> <Label>Store</Label> </TableColumnHeader> <TableColumnHeader> <Label>Thumbprint</Label> <Width>41</Width> </TableColumnHeader> <TableColumnHeader> <Label>Key</Label> <Alignment>Center</Alignment> </TableColumnHeader> <TableColumnHeader> <Label>Subject</Label> <Width>40</Width> </TableColumnHeader> <TableColumnHeader> <Label>Permissions</Label> </TableColumnHeader> </TableHeaders> <TableRowEntries> <TableRowEntry> <Wrap/> <TableColumnItems> <TableColumnItem> <ScriptBlock>[string]::Format("{0}\{1}", $_.Location, $_.Store)</ScriptBlock> </TableColumnItem> <TableColumnItem> <PropertyName>Thumbprint</PropertyName> </TableColumnItem> <TableColumnItem> <ScriptBlock> if ($_.HasPrivateKey) { "$($PSStyle.Foreground.Green)Y$($PSStyle.Reset)" } else { " " } </ScriptBlock> </TableColumnItem> <TableColumnItem> <PropertyName>Subject</PropertyName> </TableColumnItem> <TableColumnItem> <ScriptBlock> $okColor = "$([char]0x1b)[38;5;47m" $criticalColor = "$([char]0x1b)[38;5;198m" $output = @() foreach ($perm in $_.Permissions) { $access = "[$($perm.AccessType.ToString())]" if ($perm.AccessType -eq "Allow") { $color = $okColor } else { $color = $criticalColor; $access += " " } $output += "$color$access$($PSStyle.Reset) $($PSStyle.Foreground.BrightCyan){$($perm.FileSystemRights)}$($PSStyle.Reset) $($perm.Identity)" } [string]::Join("`n", $output) </ScriptBlock> </TableColumnItem> </TableColumnItems> </TableRowEntry> </TableRowEntries> </TableControl> </View> </ViewDefinitions> </Configuration> |