Just a quick post, as much as a reminder for me as anything, but also useful to those that attended my sessions last week where I talked about snippets in PowerShell ISE
Jeff Hicks wrote a post explaining how to create snippets in VS Code for PowerShell
I love using snippets so I went and converted my snippets list for ISE (available on GitHub) into the json required for VS Code (available on GitHub)
[code]"SMO-Server": {
"prefix": "SMO-Server",
"body": [
"$$srv = New-Object Microsoft.SqlServer.Management.Smo.Server $$Server"
],
"description": "Creates a SQL Server SMO Object"
},
I followed this process in this order
Click File –> Preferences –> User Snippets and type PowerShell or edit $env:\appdata\code\user\snippets\powershell.json
In order I converted the code in the existing snippets “Text” like this
