@@ -39,41 +39,64 @@ PS C:\> Get-FormatData
3939This command gets all the formatting data in the session.
4040
4141### Example 2: Get formatting data by type name
42- ```
43- PS C:\> Get-FormatData -TypeName "Microsoft.Wsman*"
42+ ``` powershell
43+ PS C:\> Get-FormatData -TypeName 'System.Management.Automation.Cmd*'
4444```
4545
46- This command gets the formatting data items whose names begin with Microsoft.Wsman .
46+ This command gets the formatting data items whose names begin with System.Management.Automation.Cmd * .
4747
4848### Example 3: Examine a formatting data object
49- ```
50- PS C:\> $F = Get-FormatData -TypeName helpinfoshort
49+ ``` powershell
50+ PS C:\> $F = Get-FormatData -TypeName 'System.Management.Automation.Cmd*'
5151PS C:\> $F
52+ ```
53+ ``` Output
5254TypeName FormatViewDefinition
5355-------- --------------------
54- HelpInfoShort {help , TableControl} PS C:\> $F.FormatViewDefinition[0].control
55- Headers Rows
56- ------- ----
57- {System.Management.Automation.TableControlColumnHeader, System.Manageme... {System.Management.Automation.TableControlRow} PS C:\> $F.FormatViewDefinition[0].control.headers
58- Label Alignment Width
59- ----- --------- -----
60- Name Left 33
61- Category Left 9
62- Undefined 0
56+ HelpInfoShort {help , TableControl}
57+ ```
58+ ``` powershell
59+ PS C:\> $F.FormatViewDefinition[0].control
60+ ```
61+ ``` Output
62+ Headers : {System.Management.Automation.TableControlColumnHeader, System.Management.Automation.TableControlColumnHeader, System.Management.Automation.TableControlColumnHeader,
63+ System.Management.Automation.TableControlColumnHeader}
64+ Rows : {System.Management.Automation.TableControlRow}
65+ AutoSize : False
66+ HideTableHeaders : False
67+ GroupBy :
68+ OutOfBand : False
69+ ```
70+ ``` powershell
71+ PS C:\> $F.FormatViewDefinition[0].control.Headers
72+ ```
73+ ``` Output
74+ Label Alignment Width
75+ ----- --------- -----
76+ CommandType Undefined 15
77+ Name Undefined 50
78+ Version Undefined 10
79+ Source Undefined 0
6380```
6481
6582This example shows how to get a formatting data object and examine its properties.
6683
6784### Example 4: Get formatting data and export it
68- ```
85+ ``` powershell
6986PS C:\> $A = Get-FormatData
7087PS C:\> Import-Module bitstransfer
7188PS C:\> $B = Get-FormatData
7289PS C:\> Compare-Object $A $B
90+ ```
91+ ``` Output
7392InputObject SideIndicator
7493----------- -------------
7594Microsoft.BackgroundIntelligentTransfer.Management.BitsJob => PS C:\> Get-FormatData *bits* | Export-FormatData -FilePath c:\test\bits.format.ps1xml
95+ ```
96+ ``` powershell
7697PS C:\> Get-Content c:\test\bits.format.ps1xml
98+ ```
99+ ``` Output
77100<?xml version="1.0" encoding="utf-8"?><Configuration><ViewDefinitions>
78101<View><Name>Microsoft.BackgroundIntelligentTransfer.Management.BitsJob</Name>
79102...
@@ -88,10 +111,59 @@ It uses a pipeline operator (|) to send the format type object to the Export-For
88111
89112The final command shows an excerpt of the format.ps1xml file content.
90113
114+ ### Example 5: Get formatting data based on the specified version of PowerShell
115+ ``` powershell
116+ PS C:\> Get-FormatData -TypeName 'Microsoft.Powershell.Utility.FileHash' -PowerShellVersion 1.0
117+
118+ TypeNames FormatViewDefinition
119+ --------- --------------------
120+ {Microsoft.Powershell.Utility.FileHash} {Microsoft.Powershell.Utility.FileHash}
121+
122+ PS C:\> Get-FormatData -TypeName 'Microsoft.Powershell.Utility.FileHash' -PowerShellVersion 2.0
123+
124+ TypeNames FormatViewDefinition
125+ --------- --------------------
126+ {Microsoft.Powershell.Utility.FileHash} {Microsoft.Powershell.Utility.FileHash}
127+
128+ PS C:\> Get-FormatData -TypeName 'Microsoft.Powershell.Utility.FileHash' -PowerShellVersion 3.0
129+
130+ TypeNames FormatViewDefinition
131+ --------- --------------------
132+ {Microsoft.Powershell.Utility.FileHash} {Microsoft.Powershell.Utility.FileHash}
133+
134+ PS C:\> Get-FormatData -TypeName 'Microsoft.Powershell.Utility.FileHash' -PowerShellVersion 4.0
135+
136+ TypeNames FormatViewDefinition
137+ --------- --------------------
138+ {Microsoft.Powershell.Utility.FileHash} {Microsoft.Powershell.Utility.FileHash}
139+
140+ PS C:\> Get-FormatData -TypeName 'Microsoft.Powershell.Utility.FileHash' -PowerShellVersion 5.0
141+
142+ TypeNames FormatViewDefinition
143+ --------- --------------------
144+ {Microsoft.Powershell.Utility.FileHash} {Microsoft.Powershell.Utility.FileHash}
145+
146+ PS C:\> Get-FormatData -TypeName 'Microsoft.Powershell.Utility.FileHash' -PowerShellVersion 5.1
147+
148+ TypeNames FormatViewDefinition
149+ --------- --------------------
150+ {Microsoft.Powershell.Utility.FileHash} {Microsoft.Powershell.Utility.FileHash}
151+
152+ PS C:\> Get-FormatData -TypeName 'Microsoft.Powershell.Utility.FileHash' -PowerShellVersion 6.0
153+
154+ TypeNames FormatViewDefinition
155+ --------- --------------------
156+ {Microsoft.Powershell.Utility.FileHash} {Microsoft.Powershell.Utility.FileHash}
157+ ```
158+
159+ This example shows how to use ** Get-FormatData** to get format data for a specified TypeName and a
160+ specified PowerShell version.
161+
91162## PARAMETERS
92163
93164### -PowerShellVersion
94-
165+ Specify the version of PowerShell this cmdlet gets for the formatting data.
166+ Enter a two digit number seperated by a period.
95167
96168``` yaml
97169Type : Version
0 commit comments