| external help file | PSWebGui-help.xml |
|---|---|
| Module Name | PSWebGui |
| online version | |
| schema | 2.0.0 |
Formats and stylizes PowerShell commands output using HTML and Bootstrap.
Format-Html [-InputObject] <PSObject> [-Darktable] [-Darkheader] [-Striped] [-Hover] [-Id <String>] [-Class <array>] [<CommonParameters>]Format-Html [-InputObject] <PSObject> -Cards <Int32> [-Id <String>] [-Class <array>] [<CommonParameters>]Format-Html [-InputObject] <PSObject> [-Raw] [<CommonParameters>]Converts the output of PowerShell commands, passed by pipeline, to HTML format and adds Bootstrap style classes.
Depending on the set of parameters, the output can be converted to table format, card format, or raw (no style). If no parameters are set, by default it is converted to table format.
In essence, it is like ConverTo-Html -Fragment PowerShell cmdlet but with Bootstrap styling built-in and another features.
PS> Get-Service | Format-Html
<table class='table'>
<thead>
<tr>
<th>Name</th>
<th>RequiredServices</th>
<th>CanPauseAndContinue</th>
...
</tr>
</thead>
<tbody>
<tr>
<td>AJRouter</td>
<td>System.ServiceProcess.ServiceController[]</td>
<td>False</td>
...
</tr>
<tr>
<td>ALG</td>
<td>System.ServiceProcess.ServiceController[]</td>
<td>False</td>
...
</tr>
...
</tbody>
</table>PS> Get-Process | Select-Object Cpu, Name | Format-Html -Darkheader -Striped -Hover -Id "myTable" -Class "myClass","yourClass"
<table class='table table-striped table-hover myClass yourClass' id='myTable'>
<thead class='thead-dark'>
<tr>
<th>CPU</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1475,09375</td>
<td>msedge.exe</td>
</tr>
<tr>
<td>0,671875</td>
<td>explorer.exe</td>
</tr>
...
</tbody>
</table>PS> Get-Service | Select-Object Status, DisplayName | Format-Html -Cards 3
<div class='row row-cols-3'>
<div class='col mb-1'>
<div class='card h-100'>
<div class='card-body'>
<h5 class='card-title'>Stopped</h5>
<p class='card-text'>AJRouter</p>
</div>
</div>
</div>
<div class='col mb-1'>
<div class='card h-100'>
<div class='card-body'>
<h5 class='card-title'>Running</h5>
<p class='card-text'>ALG</p>
</div>
</div>
</div>
...
</div>PS> Get-Date | Format-Html -Raw
Tuesday, June 25, 2019 14:53:32Command or object to be formated in HTML, passed by pipeline.
Type: PSObject
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseSet this parameter to display a dark table.
<table class="table table-dark">...</table>Type: SwitchParameter
Parameter Sets: Table
Aliases: Tabledark, Table-dark
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSet this parameter to display a table with dark header.
<table class="table">
<thead class="thead-dark">...</thead>
</table>Type: SwitchParameter
Parameter Sets: Table
Aliases: Theaddark, Thead-dark
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSet this parameter to display a striped table.
<table class="table table-striped">...</table>Type: SwitchParameter
Parameter Sets: Table
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSet this parameter to display a hoverable rows table.
<table class="table table-hover">...</table>Type: SwitchParameter
Parameter Sets: Table
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseUse this parameter to set an id attribute.
<table id="table1">...</table>Type: String
Parameter Sets: Cards, Table
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies a number, between 1 and 6, to display the command output in Bootstrap card style. The number specified is the number of cards displayed per row.
This parameter only displays the first two properties of the object passed. The first one will be dipslayed as the card title, the second will be the card text. (See the cards section of the Bootstrap v4.6 documentation for more info about card layout)
Type: Int32
Parameter Sets: Cards
Aliases:
Required: True
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: FalseUse this parameter to set an array of classes for the table or cards.
<table clas="table myClass">...</table><div class="row-cols-3 myClass" >...</div>Type: Array
Parameter Sets: Cards, Table
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSet this parameter to display output in HTML format but without style.
Type: SwitchParameter
Parameter Sets: Raw
Aliases:
Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.