{"id":5907,"date":"2018-03-02T15:57:25","date_gmt":"2018-03-02T20:57:25","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=5907"},"modified":"2018-03-02T15:57:25","modified_gmt":"2018-03-02T20:57:25","slug":"extending-vscode-with-powershell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/","title":{"rendered":"Extending VSCode with PowerShell"},"content":{"rendered":"<p>Last year I made a conscious decision to jump into VS Code as my primary PowerShell development tool. I had spent years tweaking and customizing the PowerShell ISE so I was a little concerned about the transition.\u00a0 But I knew the only way I'd master VS Code (and I still have a long way to go) would be to use it all the time. One of the features of VSCode that made this possible is PowerShellEditorServices. Much of the functionality is exposed through the $PSEditor object in VS Code, similar to $PSISE in the PowerShell ISE. Unfortunately, there is not a lot of IT Pro friendly material on the topic. So let me add a little bit.<\/p>\n<p><!--more--><\/p>\n<p>In my VS Code profile ($profile), I add commands to configure the editor. One of the things I do is use the <a title=\"read the help online\" href=\"https:\/\/github.com\/PowerShell\/PowerShellEditorServices\/blob\/master\/module\/docs\/Register-EditorCommand.md\" target=\"_blank\" rel=\"noopener\">Register-EditorCommand<\/a> cmdlet to add custom commands. I can get them by accessing the command palette and selecting PowerShell: Show Additional Commands from PowerShell Modules.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image_thumb.png\" alt=\"image\" width=\"1028\" height=\"514\" border=\"0\" \/><\/a><\/p>\n<p>When I select that I get a list of available commands:<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image_thumb-1.png\" alt=\"image\" width=\"1028\" height=\"300\" border=\"0\" \/><\/a><\/p>\n<p>These are commands I defined in my VSCode profile and added. Here's how.<\/p>\n<p>I use Open Live Writer to prepare blog posts. My blog uses the Crayon plugin to format code samples. To speed things up, I can insert the necessary HTML code into my local source. In the PowerShell ISE I had a custom menu add-on that would copy selected text, insert the necessary HTML and copy the result to the clipboard where I could paste it into Open Live Writer. I needed to do the same thing for VS Code.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">Function ExportAsCrayon {\r\n    [cmdletbinding()]\r\n    param ([Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context)\r\n\r\n    $text = $context.CurrentFile.GetText($context.SelectedRange).Replace(\"&gt;\", \"&amp;gt;\").Replace(\"&lt;\", \"&amp;lt;\").Trim()\r\n    $code = @\"\r\n&lt;pre class=\"lang:ps mark:0 decode:true\"&gt;\r\n$text\r\n&lt;\/pre&gt;\r\n\"@  \r\n    $code | Set-clipboard\r\n    $psEditor.Window.ShowInformationMessage(\"The selected text has been converted and copied to the clipboard.\")\r\n}\r\n<\/pre>\n<p>Most functions you write for VSCode will likely use the $Context parameter. As the name suggests, this tells VSCode where you are and gives you access to some methods and properties. In my function I am using the CurrentFile object and the GetText() method to get the selected text. The tricky thing is that the parameter you need to pass is the SelectedRange property from $Context.\u00a0 This is one of those things that isn't very well documented. The rest of my code is using the Replace() method to escape the angle bracket characters for my HTML. This is plugged into a here string, $code, which is sent to the clipboard.<\/p>\n<p>&nbsp;<\/p>\n<p>The last step is to invoke the ShowInformationMessage() which will provide a visual prompt.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image_thumb-2.png\" alt=\"image\" width=\"1028\" height=\"61\" border=\"0\" \/><\/a><\/p>\n<p>You can also use methods like this:<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">$pseditor.window.ShowErrorMessage(\"You made a mistake\")\r\n$pseditor.window.ShowWarningMessage(\"I wouldn't do that if I were you.\")\r\n<\/pre>\n<p>Once I have the function, I can register it with VS Code.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">Register-EditorCommand -Name ExportAsCrayon -DisplayName \"Export Code as Crayon\" -Function ExportAsCrayon\r\n<\/pre>\n<p>This is a PowerShell cmdlet so you can read help about it. The Name is the programmatic name and the DisplayName is what you see in the drop down list.<\/p>\n<p>But to access this command takes several keyboard steps. VS Code is full of keyboard shortcuts and bindings. I'd like to create my own.<\/p>\n<p>Unfortunately, there is no way currently to programmatically create or define a keyboard shortcut. Instead you need to go to\u00a0 File \u2013 Preferences \u2013 Keyboard Shortcuts and then click the link to edit keybindings.json.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image_thumb-3.png\" alt=\"image\" width=\"1028\" height=\"517\" border=\"0\" \/><\/a><\/p>\n<p>The default application settings will be in the left panel and your custom settings will be in the right. To add a new one, insert a comma after the last one but before the closing square bracket. Then enter a set of {}.<\/p>\n<p>You will need to enter a key.\u00a0 I'll use Ctrl+F6. The setting for \"command\" will be \"PowerShell.InvokeRegisteredEditorCommand\". The tricky part, and what took me the longest to figure out, is the parameter or argument value. The method is pretty clear about what it is going to do. Create an \"args\" key with a value that looks like this:\u00a0 \"commandName\": \"ExportAsCrayon\"}. Use the short name of your registered command. Optionally, you can add a setting for \"when\" the keybinding is active. I want mine to be when the editor is active. Here's the complete json entry.<\/p>\n<pre class=\"lang:ps mark:0 decode:true \">{\r\n  \"key\":\"ctrl+f6\",\r\n  \"command\": \"PowerShell.InvokeRegisteredEditorCommand\",\r\n  \"args\" : {\"commandName\": \"ExportAsCrayon\"},\r\n  \"when\": \"editorTextFocus\"\r\n}\r\n<\/pre>\n<p>Save the file and you are ready to use it. If you don't get the results you expect or errors, check your entry. Json is case sensitive. The args entry must be \"commandName\". I generally try to follow case based on other key binding entries.<\/p>\n<p>But now I'm all set. The Register-EditorCommand expression is in my VSCode profile and I only have to add the keybinding once. Now I can select text, press Ctrl+F6 and get my Crayon-formatted code copied to the clipboard.<\/p>\n<p>&nbsp;<\/p>\n<p>I hope this helps you and saves a little head banging. I think I've done enough of that for all of us.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last year I made a conscious decision to jump into VS Code as my primary PowerShell development tool. I had spent years tweaking and customizing the PowerShell ISE so I was a little concerned about the transition.\u00a0 But I knew the only way I&#8217;d master VS Code (and I still have a long way to&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New on the blog: Extending VSCode with #PowerShell","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,8,525],"tags":[534,591,526],"class_list":["post-5907","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","category-vscode","tag-powershell","tag-powershelleditorservices","tag-vscode"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Extending VSCode with PowerShell &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Extending VSCode with PowerShell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Last year I made a conscious decision to jump into VS Code as my primary PowerShell development tool. I had spent years tweaking and customizing the PowerShell ISE so I was a little concerned about the transition.\u00a0 But I knew the only way I&#039;d master VS Code (and I still have a long way to...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-02T20:57:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image_thumb.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Extending VSCode with PowerShell\",\"datePublished\":\"2018-03-02T20:57:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/\"},\"wordCount\":756,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/image_thumb.png\",\"keywords\":[\"PowerShell\",\"PowerShellEditorServices\",\"VSCode\"],\"articleSection\":[\"PowerShell\",\"Scripting\",\"VSCode\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/\",\"name\":\"Extending VSCode with PowerShell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/image_thumb.png\",\"datePublished\":\"2018-03-02T20:57:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/image_thumb.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/image_thumb.png\",\"width\":1028,\"height\":514},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5907\\\/extending-vscode-with-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Extending VSCode with PowerShell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Extending VSCode with PowerShell &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Extending VSCode with PowerShell &#8226; The Lonely Administrator","og_description":"Last year I made a conscious decision to jump into VS Code as my primary PowerShell development tool. I had spent years tweaking and customizing the PowerShell ISE so I was a little concerned about the transition.\u00a0 But I knew the only way I'd master VS Code (and I still have a long way to...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/","og_site_name":"The Lonely Administrator","article_published_time":"2018-03-02T20:57:25+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image_thumb.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Extending VSCode with PowerShell","datePublished":"2018-03-02T20:57:25+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/"},"wordCount":756,"commentCount":2,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image_thumb.png","keywords":["PowerShell","PowerShellEditorServices","VSCode"],"articleSection":["PowerShell","Scripting","VSCode"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/","name":"Extending VSCode with PowerShell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image_thumb.png","datePublished":"2018-03-02T20:57:25+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image_thumb.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/03\/image_thumb.png","width":1028,"height":514},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5907\/extending-vscode-with-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Extending VSCode with PowerShell"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":5078,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5078\/configuring-the-vscode-powershell-terminal\/","url_meta":{"origin":5907,"position":0},"title":"Configuring the VSCode PowerShell Terminal","author":"Jeffery Hicks","date":"June 9, 2016","format":false,"excerpt":"Yesterday I posted my experiences in setting up the latest build of VSCode on how to use a PowerShell terminal session. As I explained, in this particular session I didn't want to run any profile scripts. My reasoning was that this session obviously wasn't the ISE nor was I likely\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"VSCode PowerShell Session","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-8.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-8.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-8.png?resize=525%2C300 1.5x"},"classes":[]},{"id":8378,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8378\/powershell-tough-love\/","url_meta":{"origin":5907,"position":1},"title":"PowerShell Tough Love","author":"Jeffery Hicks","date":"May 6, 2021","format":false,"excerpt":"The other day I was helping Gladys Kravitz on her transition to VS Code. Like many of you, she has been using the PowerShell ISE for years and has a deeply ingrained workflow. I'll be the first to admit that making the transition to VS Code is not easy. I\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/05\/pexels-cottonbro-7670313.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":5073,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5073\/powershell-sessions-and-vs-code\/","url_meta":{"origin":5907,"position":2},"title":"PowerShell Sessions and VS Code","author":"Jeffery Hicks","date":"June 8, 2016","format":false,"excerpt":"If you do any amount of PowerShell scripting you have most likely heard about Visual Studio Code. This is a free cross-platform light-weight editor from Microsoft. VS Code supports multiple languages and is extensible. I've tried different versions since it was first released but never found a reason to jump\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-5.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-5.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-5.png?resize=525%2C300 1.5x"},"classes":[]},{"id":5499,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5499\/more-fun-with-vscode-snippets\/","url_meta":{"origin":5907,"position":3},"title":"More Fun with VSCode Snippets","author":"Jeffery Hicks","date":"March 13, 2017","format":false,"excerpt":"A few days ago I posted an entry that explained how to create and use snippets in Visual Studio Code. As mentioned in that article I'm attempting to make the transition to VSCode for all my PowerShell work. Being able to use snippets is just one feature that I rely\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/03\/image_thumb-10.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":9198,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9198\/best-practices-make-perfect\/","url_meta":{"origin":5907,"position":4},"title":"Best Practices Make Perfect","author":"Jeffery Hicks","date":"January 11, 2023","format":false,"excerpt":"This post is a reprint from an article published to my premium PowerShell newsletter Behind the PowerShell Pipeline available on Substack. Subscribers receive 6-8 articles like this a month delivered to their inbox or available on the Substack app. I hope you'll consider subscribing. Trial subscriptions are available. Over the\u2026","rel":"","context":"In &quot;Best Practices&quot;","block_context":{"text":"Best Practices","link":"https:\/\/jdhitsolutions.com\/blog\/category\/best-practices\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2023\/01\/format-document.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2023\/01\/format-document.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2023\/01\/format-document.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2023\/01\/format-document.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":8741,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8741\/building-a-powershell-module-inception-style\/","url_meta":{"origin":5907,"position":5},"title":"Building a PowerShell Module Inception-Style","author":"Jeffery Hicks","date":"December 17, 2021","format":false,"excerpt":"Over the course of the last week or so, I've been sharing PowerShell functions and scripts for working with PowerShell functions and scripts. I showed PowerShell functions to export functions to a script file and code to convert scripts to functions It has all been very Inception-like. To wrap this\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/12\/psinception.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=5907"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5907\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=5907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=5907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=5907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}