CmdID / PowerShell / Cmdlets / Export
Export-FormatData
Saves formatting data from the current session in a formatting file. PowerShell reference
From the PowerShell reference 6 parameters
What it does
Saves formatting data from the current session in a formatting file. The Export-FormatData cmdlet creates PowerShell formatting files (format.ps1xml) from the formatting objects in the current session. It takes the ExtendedTypeDefinition objects that Get-FormatData returns and saves them in a file in XML format. PowerShell uses the data in formatting files (format.ps1xml) to generate the default display of Microsoft .NET Framework objects in the session. You can view and edit the formatting files and use the Update-FormatData cmdlet to add the formatting data to a session. For more information about formatting files in PowerShell, see about_Format.ps1xml.
Export-FormatData -InputObject <ExtendedTypeDefinition[]> -Path <String> [-Force] [-NoClobber] [-IncludeScriptBlock] [<CommonParameters>]Export-FormatData -InputObject <ExtendedTypeDefinition[]> -LiteralPath <String> [-Force] [-NoClobber] [-IncludeScriptBlock] [<CommonParameters>]
Export session format data
Get-FormatData -TypeName "*" |
Export-FormatData -Path "AllFormat.ps1xml" -IncludeScriptBlockIdentifyExport format data for a type
$F = Get-FormatData -TypeName "HelpInfoShort"
Export-FormatData -InputObject $F -Path "C:\test\Help.format.ps1xml" -IncludeScriptBlockIdentifyExport format data without a scriptblock
Get-FormatData -TypeName "System.Diagnostics.Process" |
Export-FormatData -Path Process.format.ps1xml
Update-FormatData -PrependPath ".\Process.format.ps1xml"
Get-Process p*IdentifyIts page in the reference: Export-FormatData.
Parameters
-ForceForces the command to run without asking for user confirmation.-IncludeScriptBlockIndicates whether scriptblocks in the format data are exported.
Because scriptblocks contain code and can be used maliciously, they are not exported by default.-InputObjectSpecifies the format data objects to be exported. Enter a variable that contains the objects or a command that gets the objects, such as a Get-FormatData command. You can also pipe the objects from Get-FormatData to Export-FormatData.-LiteralPathSpecifies a location for the output file. Unlike the Path parameter, the value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences.-NoClobberIndicates that the cmdlet does not overwrite existing files. By default, Export-FormatData overwrites files without warning unless the file has the read-only attribute.
To direct Export-FormatData to overwrite read-only files, use the Force parameter.-PathSpecifies a location for the output file. Enter a path (optional) and file name with a format.ps1xml file name extension. If you omit the path, Export-FormatData creates the file in the current directory.
If you use a file name extension other than .ps1xml, the Update-FormatData cmdlet will not recognize the file.
If you specify an existing file, Export-FormatData overwrites the file without warning, unless the file has the read-only attribute. To overwrite a read-only file, use the Force parameter. To prevent files from being overwritten, use the NoClobber parameter.