How to Create a Formatting File (.format.ps1xml)
This topic describes how to create a formatting file (.format.ps1xml).
Note
You can also create a formatting file by making a copy of one of the files provided by Windows PowerShell. If you make a copy of an existing file, delete the existing digital signature, and add your own signature to the new file.
Create a .format.ps1xml file.
Create a text file (.txt) using a text editor such as Notepad.
Copy the following lines into the formatting file.
<?xml version="1.0" encoding="utf-8" ?> <Configuration> <ViewDefinitions> </ViewDefinitions> </Configuration>
The
<Configuration></Configuration>
tags define the rootConfiguration
node. All additional XML tags will be enclosed within this node.The
<ViewDefinitions></ViewDefinitions>
tags define theViewDefinitions
node. All views are defined within this node.
Save the file to the Windows PowerShell installation folder, to your module folder, or to a subfolder of the module folder. Use the following name format when you save the file:
MyFile.format.ps1xml
. Formatting files must use the.format.ps1xml
extension.You are now ready to add views to the formatting file. There is no limit to the number of views that can be defined in a formatting file. You can add a single view for each object, multiple views for the same object, or a single view that is used by multiple objects.