| description | How to Create a Formatting File (Format.ps1xml) |
|---|---|
| ms.date | 12/26/2025 |
| title | 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. To protect the users of your Format.ps1xml file, sign the file using a digital
signature. For more information, see about_Signing.
-
Open a new text file using a text editor such as Visual Studio Code.
-
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 rootConfigurationnode. All additional XML tags will be enclosed within this node. -
The
<ViewDefinitions></ViewDefinitions>tags define theViewDefinitionsnode. All views are defined within this node.
-
-
Save the file to a folder of your choice. If you are writing a module, save the file 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.ps1xmlextension.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.