Saves formatting data from the current session in a formatting file. (Export-FormatData)

   

# NAME
Export-FormatData

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

# SYNTAX
Export-FormatData [-Force] [-IncludeScriptBlock] [-InputObject <ExtendedTypeDefinition[]>] [-NoClobber] [-Path <string>] [<CommonParameters>]

# 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.

# PARAMETERS
-Force [<SwitchParameter>]
Overwrites an existing output file, even if the file has the read-only attribute.

Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false

-IncludeScriptBlock [<SwitchParameter>]
Determines whether script blocks in the format data are exported.

Because script blocks contain code and can be used maliciously, they are not exported by default.

Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false

-InputObject <ExtendedTypeDefinition[]>
Specifies 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.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

-NoClobber [<SwitchParameter>]
Prevents the cmdlet from overwriting 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.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Path <string>
Specifies 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.

Required? false
Position? named
Default value None
Accept pipeline input? false
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
System.Management.Automation.ExtendedTypeDefinition
You can pipe ExtendedTypeDefinition objects from Get-FormatData to Export-FormatData.

# OUTPUTS
None
Export-FormatData does not return any objects. It generates a file and saves it in the specified path.

# NOTES

To use any formatting file, including an exported formatting file, the execution policy for the session must allow scripts and configuration files to run. For more information, see about_Execution_Policies.

# EXAMPLE 1

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

# Description
-----------
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

C:\PS>$f = get-formatdata -typename helpinfoshort

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

# Description
-----------
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

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

C:\PS> Update-FormatData -prependPath .\process.format.ps1xml

C:\PS> 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

# Description
-----------
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.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=144302
Get-FormatData
Update-FormatData

C:\Windows>powershell get-help Register-ObjectEvent -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows-10 / Windows-8.1 & 8 / Windows-7 & Vista / Windows Server 2008-2016
»»»» ColorConsole



 


... Home  
... Impressum
... ColorConsole

... CMD
... Netsh-XP
... Netsh-7
... Netsh-Vista
... Powershell





;-)









Download the Windows 10 Starter, Home (Basic Premium), Professional und Ultimate!

... facebook.de
0.093
Wie kann ich in MeinPlatz in meine Landessprache übersetzen!   / Problems if try to run a downloaded program from Internet on Windows-8.1?  / How to create a virtual hard disk on Windows 8, 8.1 and Win 10 (VHD)?  / How can i force move or copy of the data while dragging?  / In Windows 8/10 und 8.1 virtuelle Laufwerke wie z.B. ISO-Images oder VHD-Laufwerke mounten!  / Die Datenträgerverwaltung in Windows 8 und 8.1 öffnen, bzw. starten, finden?  / Externe Laufwerke werden unter Windows 10 nicht angezeigt?  / Wie kann ich mehrere virtuelle Desktops unter Windows 10 verwenden?  / Extend test period in Windows 8.1 and 8 or delay activation!  / Wo ist der Speicherort vom Win 7 User-Konto Bild, wo ist das Verzeichnis?  / Your Android device does not support data connection error message!  / Is Pointer Stick not a joke program, who needs something like this?  /