@@ -39,41 +39,64 @@ PS C:\> Get-FormatData
39
39
This command gets all the formatting data in the session.
40
40
41
41
### 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*'
44
44
```
45
45
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 * .
47
47
48
48
### 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*'
51
51
PS C:\> $F
52
+ ```
53
+ ``` Output
52
54
TypeName FormatViewDefinition
53
55
-------- --------------------
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
63
80
```
64
81
65
82
This example shows how to get a formatting data object and examine its properties.
66
83
67
84
### Example 4: Get formatting data and export it
68
- ```
85
+ ``` powershell
69
86
PS C:\> $A = Get-FormatData
70
87
PS C:\> Import-Module bitstransfer
71
88
PS C:\> $B = Get-FormatData
72
89
PS C:\> Compare-Object $A $B
90
+ ```
91
+ ``` Output
73
92
InputObject SideIndicator
74
93
----------- -------------
75
94
Microsoft.BackgroundIntelligentTransfer.Management.BitsJob => PS C:\> Get-FormatData *bits* | Export-FormatData -FilePath c:\test\bits.format.ps1xml
95
+ ```
96
+ ``` powershell
76
97
PS C:\> Get-Content c:\test\bits.format.ps1xml
98
+ ```
99
+ ``` Output
77
100
<?xml version="1.0" encoding="utf-8"?><Configuration><ViewDefinitions>
78
101
<View><Name>Microsoft.BackgroundIntelligentTransfer.Management.BitsJob</Name>
79
102
...
@@ -88,10 +111,59 @@ It uses a pipeline operator (|) to send the format type object to the Export-For
88
111
89
112
The final command shows an excerpt of the format.ps1xml file content.
90
113
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
+
91
162
## PARAMETERS
92
163
93
164
### -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.
95
167
96
168
``` yaml
97
169
Type : Version
0 commit comments