Академический Документы
Профессиональный Документы
Культура Документы
Module Overview
List and explain the rules that the shell follows when
of a Format- cmdlet
default formatting
of a Format- cmdlet
default formatting
Formatting Defaults
Nearly every PowerShell cmdlet produces some sort of
The shell loads these files each time it starts, storing view
information for the duration of the shell session
This type extension is also stored in an XML file, this time with
a .types.ps1xml extension
signed, and will not load if they have been modified in any
way
extension
to display
Default behavior:
Out-Default
The Out-Default cmdlet
Get-Process
Get-Process | Out-Default
Get-Process | Out-Host
You generally do not need to invoke Out-Default. However
Get-Process
Get-Process | Out-Default | Out-Host | Format-Table | Out-Host
The formatting system internally determines which
Multiple Views
PowerShell uses, by default, the first predefined view it
cmdlets
calculated columns
Customizing Defaults
You can create custom formatting views by creating your
This cmdlet registers the views in your file for the currentlyrunning shell session. It will need to be run in each session.
the shell
Format-Table
Format-List
Format-Wide
Format-Custom
Custom Columns
You can use Select-Object to add custom attributes to an
object.
Get-ADComputer filter * |
Select
*,@{Label='ComputerName';Expression={$_.Name}}
The special $_. placeholder stands in for whatever SelectObject was given in this case, a set of computer names
of cmdlets
HTML Output
Sometimes, you want to format data so it can be viewed
in a Web browser
Itself does not write HTML to a file, but instead places string
elements into the pipeline
Terminology Reminder
Remember that PowerShell uses formal terms to describe
However, you may want to use the formal words as you grow
in experience because it makes communication easier
Demonstration: ConvertTo-HTML
Learn how to convert information to HTML and display the
Logon information
Virtual machine
LON-DC1
LON-SVR1
Contoso\Administrator
Contoso\Administrator
Password
Pa$$w0rd
Pa$$w0rd
Lab Scenario
You are a system administrator for a company and work
Lab Review
It would be nice to be able to format the color of each row