{"id":2023,"date":"2024-10-15T11:39:22","date_gmt":"2024-10-15T03:39:22","guid":{"rendered":"https:\/\/ramfree17.net\/capsule\/?p=2023"},"modified":"2025-05-28T20:57:33","modified_gmt":"2025-05-28T12:57:33","slug":"scoped-vs-code-powershell-profile","status":"publish","type":"post","link":"https:\/\/ramfree17.net\/capsule\/?p=2023","title":{"rendered":"Scoped VS Code Powershell profile"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"> As of writing, I am working on a very controlled client environment (i.e. Citrix session) where the home drive is in a network share, and the machine session has a locked policy of only allowing signed poweshell scripts to execute.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I have my scripts in the Powershell folder which then gets this error because they are not digitally signed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/pw\/AP1GczO09xZ0bxu1YFG5He_zW8BqY5Diqu0DgXFGXC8rRbnHsxxHwlAkhg2CnT0XAVEhblr3qenPKHnWbCmC66xC9h0harRe5SXtBPntyw3Xha-AV__5eDAxRtMNn3-F56haIV9_rH3rJm0bv8UfRE7mFD6p=w1024-h185-s-no?authuser=0\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A solution presented is to run a new powershell session with the execution policy for the current user set to Bypass. Normally this needs to be done as an admin but it should be doable using the normal user.  I wanted this to be part of my VS Code setup and this is how I configured it:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to File-&gt;Preferences-&gt;Settings  dialog (or press Ctrl+,)<\/li>\n\n\n\n<li>In the search box, type in &#8220;@feature:terminal  integrated.profiles.windows&#8221;  <\/li>\n\n\n\n<li>Click on the &#8220;Edit in settings.json&#8221; link to open the correct settings file.<\/li>\n\n\n\n<li>Locate the Powershell entry and add the following argument stanza to the &#8220;terminal.integrated.profiles.windows&#8221; section.<\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<pre class=\"wp-block-code\"><code>    \"args\": &#91;        \n                \"-noexit\",      \n                \"-ExecutionPolicy\",\n                \"Bypass\",\n                \"-file\",        \n                \"H:\\\\PowerShell\\\\functions.ps1\"      \n            ]  \n\n<\/code><\/pre>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/ramfree17.net\/capsule\/wp-content\/uploads\/2024\/10\/image-1.png\" alt=\"\" class=\"wp-image-2025\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Save the changes. This will now take effect in new terminal sessions started by VS Code using that profile.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/ramfree17.net\/capsule\/wp-content\/uploads\/2024\/10\/image-2.png\" alt=\"\" class=\"wp-image-2026\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>As of writing, I am working on a very controlled client environment (i.e. Citrix session) where the home drive is in a network share, and the machine session has a locked policy of only allowing signed poweshell scripts to execute. I have my scripts in the Powershell folder which then gets this error because they [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,7],"tags":[166,129,139,142],"class_list":["post-2023","post","type-post","status-publish","format-standard","hentry","category-technology","category-tipjar","tag-powershell","tag-scripting","tag-tech","tag-tipjar"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=\/wp\/v2\/posts\/2023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2023"}],"version-history":[{"count":2,"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=\/wp\/v2\/posts\/2023\/revisions"}],"predecessor-version":[{"id":2036,"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=\/wp\/v2\/posts\/2023\/revisions\/2036"}],"wp:attachment":[{"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}