Built-in Snippets
Built-in Snippets provides predefined PowerShell structures and commands that you can insert directly into your script.

Available snippets
| Snippet | Prefix | Description |
|---|---|---|
| Comment Block | block-comment | Inserts a multi-line comment block. |
| do-until | do-until | Repeats a statement list until a condition is met. |
| do-while | do-while | Repeats a statement list while a condition is met. |
| else | else | Defines what runs when all if and elseif conditions are false. |
| elseif | elseif | Adds an alternative path when an if condition is false. |
| Enum | enum | Creates a distinct type made up of named labels. |
| for | for | Creates a loop that runs while a condition evaluates to true. |
| for-reversed | forr | Creates a reversed for loop. |
| foreach | foreach | Iterates through a collection with a named variable. |
| foreach-item | foreach-item | Quickly inserts a foreach item definition after you highlight the collection variable and press Tab. |
| Hashtable | hashtable | Creates a key/value store for efficient data retrieval. |
| Here-String | hs | Inserts a here-string that escapes text but still evaluates variables. |
| Here-String (Literal) | hsl | Inserts a literal here-string that escapes all text exactly as written. |
| if | if | Runs code when a conditional test evaluates to true. |
| PSCustomObject | pscustomobject | Creates a custom object from a hashtable. |
| Region Block | region | Inserts a region block for organizing and folding code. |
| splat | splat | Uses a hashtable to pass parameters concisely. |
| switch | switch | Provides an alternative to a series of if statements. |
| try-catch | try-catch | Runs a code block and handles terminating exceptions. |
| try-catch-finally | try-catch-finally | Runs code with exception handling and a cleanup block. |
| try-finally | try-finally | Runs code and performs cleanup regardless of the outcome. |
| while | while | Repeats an action while a condition is true. |