commands

^

Invoke-DbatoolsFormatter

Author Simone Bizzotto
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Invoke-DbatoolsFormatter on GitHub.
Want to see the Bill Of Health for this command? Check out Invoke-DbatoolsFormatter.

Synopsis

Formats PowerShell function files to dbatools coding standards

Description

Applies consistent code formatting to PowerShell files using PSScriptAnalyzer's Invoke-Formatter with OTBS (One True Brace Style) settings. This function standardizes indentation, brace placement, and whitespace handling across all dbatools module files, ensuring code consistency for contributors and maintainers. Files are saved without BOM encoding and with proper line ending handling for cross-platform compatibility.

Syntax

Invoke-DbatoolsFormatter
    [-Path] <Object[]>
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Invoke-DbatoolsFormatter -Path C:\dbatools\public\Get-DbaDatabase.ps1

Reformats C:\dbatools\public\Get-DbaDatabase.ps1 to dbatools' standards

Required Parameters

-Path

Specifies the path to one or more PowerShell (.ps1) files that need to be formatted to dbatools coding standards.
Accepts pipeline input from Get-ChildItem or other file listing commands for batch processing multiple files.
Use this when you want to apply consistent OTBS formatting, proper indentation, and standardized brace placement to your dbatools contributions.

Alias FullName)
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False