PSCerts.format.ps1xml
<?xml version="1.0" encoding="utf-8" ?>
<Configuration> <Controls> <Control> <Name>CertSummaryItem-Header</Name> <CustomControl> <CustomEntries> <CustomEntry> <CustomItem> <Frame> <LeftIndent>0</LeftIndent> <CustomItem> <ExpressionBinding> <ScriptBlock> "$($PSStyle.Formatting.TableHeader)$($PSStyle.Reverse)$($PSStyle.Bold)Store Location: $($_.Location)$($PSStyle.ReverseOff)$($PSStyle.Reset)" </ScriptBlock> </ExpressionBinding> <NewLine/> </CustomItem> </Frame> </CustomItem> </CustomEntry> </CustomEntries> </CustomControl> </Control> </Controls> <ViewDefinitions> <View> <Name>CertAccessRule</Name> <ViewSelectedBy> <TypeName>PSCerts.CertAccessRule</TypeName> </ViewSelectedBy> <TableControl> <TableHeaders> <TableColumnHeader> <Label>AccessType</Label> <Alignment>Center</Alignment> </TableColumnHeader> <TableColumnHeader> <Label>Rights</Label> <Alignment>Left</Alignment> </TableColumnHeader> <TableColumnHeader> <Label>Identity</Label> </TableColumnHeader> </TableHeaders> <TableRowEntries> <TableRowEntry> <Wrap/> <TableColumnItems> <TableColumnItem> <ScriptBlock> if ($_.IsAllow) { "$($PSStyle.Foreground.Green)$($_.AccessType)" } else { "$($PSStyle.Foreground.Red)$($_.AccessType)" } </ScriptBlock> </TableColumnItem> <TableColumnItem> <ScriptBlock> if ($_.IsAllow) { $color = $PSStyle.Foreground.Green } else { $color = $PSStyle.Foreground.Red } "$color$($_.FileSystemRights.ToString("F").Replace(", ", "`n"))$($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>Cert</Label> <Width>41</Width> </TableColumnHeader> <TableColumnHeader> <Label>Key</Label> <Alignment>Center</Alignment> <Width>3</Width> </TableColumnHeader> <TableColumnHeader> <Label>Permissions</Label> </TableColumnHeader> </TableHeaders> <TableRowEntries> <TableRowEntry> <Wrap/> <TableColumnItems> <TableColumnItem> <ScriptBlock>"$($PSStyle.Foreground.BrightCyan)$($_.Location)$($PSStyle.Reset)\$($PSStyle.Foreground.BrightBlue)$($_.Store)$($PSStyle.Reset)"</ScriptBlock> </TableColumnItem> <TableColumnItem> <ScriptBlock> $output = "$($PSStyle.Foreground.White)" if ($_.DisplayName.Length -ge 41) { $output += "$($_.DisplayName.Substring(0, 37))$($PSStyle.Foreground.BrightBlack)..." } else { $output += "$($_.DisplayName)" } $output += "`n$($PSStyle.Foreground.Magenta)$($_.Thumbprint)$($PSStyle.Reset)" $output </ScriptBlock> </TableColumnItem> <TableColumnItem> <ScriptBlock> if ($_.HasPrivateKey) { "$($PSStyle.Foreground.Green)Y$($PSStyle.Reset)" } else { " " } </ScriptBlock> </TableColumnItem> <TableColumnItem> <ScriptBlock> $output = @() $maxLength = $_.Permissions ` | select @{N='Length';E={$_.FileSystemRightsString.Length}} ` | sort -Property Length -Descending ` | select -First 1 -ExpandProperty Length $maxLength = [Math]::Max($maxLength, 3) foreach ($perm in $_.Permissions) { if ($perm.IsAllow) { $access = "$($PSStyle.Bold)$($PSStyle.Foreground.BrightGreen)+$($PSStyle.BoldOff) " } else { $access = "$($PSStyle.Bold)$($PSStyle.Foreground.BrightRed)-$($PSStyle.BoldOff) " } $output += "$access$($perm.FileSystemRightsString.PadRight($maxLength)) $($PSStyle.Reset) $($perm.IdentityDisplayString)" } [string]::Join("`n", $output) </ScriptBlock> </TableColumnItem> </TableColumnItems> </TableRowEntry> </TableRowEntries> </TableControl> </View> </ViewDefinitions> </Configuration> |