Format Document

Code formatting for PowerShell.

Available in PowerShell Tools for Visual Studio 2022.2.0 or later. Requires a PowerShell Pro Tools license.

Code formatting can be accomplished by using the standard Ctrl+K, Ctrl+D keyboard shortcut within Visual Studio.

The PSScriptAnalyzer module is required to perform formatting. From Windows PowerShell, you can install PSScriptAnalyzer with Install-Module.

Install-Module 'PSScriptAnalyzer' -Scope CurrentUser

Last updated