Skip to content

Instantly share code, notes, and snippets.

@alainassaf
Created January 28, 2022 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alainassaf/2a973625793b33c32fa4ae4b52966454 to your computer and use it in GitHub Desktop.
Save alainassaf/2a973625793b33c32fa4ae4b52966454 to your computer and use it in GitHub Desktop.
My VSCode USer snippets for PowerShell
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"APAHelp": {
"prefix": "APAHelp",
"body": [
"<#",
".SYNOPSIS",
"${1:}A brief description of the function or script. This keyword can be used only once in each topic.",
".DESCRIPTION",
"${2:}A detailed description of the function or script. This keyword can be used only once in each topic.",
".PARAMETER ${3:}<Parameter-Name>",
"${4:}The description of a parameter. Add a .PARAMETER keyword for each parameter in the function or script syntax.",
".EXAMPLE",
"${5:}A sample command that uses the function or script, optionally followed by sample output and a description. Repeat this keyword for each example.",
".INPUTS",
"None",
".OUTPUTS",
"None",
".NOTES",
"NAME: ${TM_FILENAME}",
"VERSION: 1.00",
"CHANGE LOG - Version - When - What - Who",
"1.00 - ${CURRENT_MONTH}/${CURRENT_DATE}/${CURRENT_YEAR} - Initial script - Alain Assaf",
"AUTHOR: Alain Assaf",
"LASTEDIT: ${CURRENT_MONTH_NAME} ${CURRENT_DATE}, ${CURRENT_YEAR}",
".LINK",
"http: //www.linkedin.com/in/alainassaf/",
"#>"
],
"description": "PowerShell Comment Based Help"
},
"APAScriptVar": {
"prefix": "APAScriptVar",
"body": [
"#region variables",
"$$datetime = Get-Date -format \"MM-dd-yyyy_HH-mm\"",
"$$Domain = (Get-ChildItem env:USERDNSDOMAIN).value",
"$$ScriptRunner = (Get-ChildItem env:username).value",
"$$compname = (Get-ChildItem env:COMPUTERNAME).value",
"$$scriptName = $$MyInvocation.MyCommand.Name",
"$$scriptpath = $$MyInvocation.MyCommand.Path",
"$$currentDir = Split-Path $$MyInvocation.MyCommand.Path",
"#endregion"
],
"description": "Alain's Script Variables"
},
"APAEndVerbose": {
"prefix": "APAEndVerbose",
"body": [
"#SEnd cript info",
"Write-Verbose \"SCRIPT NAME: $$scriptName\"",
"Write-Verbose \"SCRIPT PATH: $$scriptPath\"",
"Write-Verbose \"SCRIPT RUNTIME: $$datetime\"",
"Write-Verbose \"SCRIPT USER: $$ScriptRunner\"",
"Write-Verbose \"SCRIPT SYSTEM: $$compname.$$domain\""
],
"description": "Ending Script Info"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment