PowerShell Logo Small

Export-FormatData



This is the built-in help made by Microsoft for the command 'Export-FormatData', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Saves formatting data from the current session in a formatting file.

SYNTAX


Export-FormatData [-Force] [-IncludeScriptBlock] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable
[<System.String>]] [-NoClobber] -InputObject <ExtendedTypeDefinition[]> -Path <String> [<CommonParameters>]
Export-FormatData [-Force] [-IncludeScriptBlock] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable
[<System.String>]] [-NoClobber] -InputObject <ExtendedTypeDefinition[]> -LiteralPath <String> [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Export-FormatData cmdlet creates Windows 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.


Windows 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 Windows PowerShell, see about_Format.ps1xml.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=293958
Get-FormatData
Update-FormatData

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>get-formatdata -typename * | export-formatdata -path allformat.ps1xml -IncludeScriptBlock



This command exports all of the format data in the session to the AllFormat.ps1xml file.

The command uses the Get-FormatData cmdlet to get the format data in the session. A value of * (all) for the TypeName parameter directs the cmdlet to get all of the data in
the session.

The command uses a pipeline operator (|) to send the format data from the Get-FormatData command to the Export-FormatData cmdlet, which exports the format data to the
AllFormat.ps1 file.

The Export-FormatData command uses the IncludeScriptBlock parameter to include script blocks in the format data in the file.










-------------------------- EXAMPLE 2 --------------------------

PS C:\>$f = get-formatdata -typename helpinfoshort
PS C:\>export-formatdata -inputObject $f -path c:\test\help.format.ps1xml -IncludeScriptBlock



These commands export the format data for the HelpInfoShort type to the Help.format.ps1xml file.

The first command uses the Get-FormatData cmdlet to get the format data for the HelpInfoShort type, and it saves it in the $f variable.

The second command uses the InputObject parameter of the Export-FormatData to enter the format data saved in the $f variable. It also uses the IncludeScriptBlock parameter
to include script blocks in the output.










-------------------------- EXAMPLE 3 --------------------------

PS C:\>get-formatdata -typename System.Diagnostics.Process | export-FormatData -path process.format.ps1xml
PS C:\>Update-FormatData -prependPath .\process.format.ps1xml
PS C:\>get-process p*

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
323 5600 powershell
336 3900 powershell_ise
138 4076 PresentationFontCache



This example shows the effect of omitting the IncludeScriptBlock parameter from an Export-FormatData command.

The first command uses the Get-FormatData cmdlet to get the format data for the System.Diagnostics.Process object that the Get-Process cmdlet returns. The command uses a
pipeline operator (|) to send the formatting data to the Export-FormatData cmdlet, which exports it to the Process.format.ps1xml file in the current directory.

In this case, the Export-FormatData command does not use the IncludeScriptBlock parameter.

The second command uses the Update-FormatData cmdlet to add the Process.format.ps1xml file to the current session. The command uses the PrependPath parameter to ensure that
the formatting data for process objects in the Process.format.ps1xml file is found before the standard formatting data for process objects.

The third command shows the effects of this change. The command uses the Get-Process cmdlet to get processes that have names that begin with "P". The output shows that
property values that are calculated by using script blocks are missing from the display.