{"id":4219,"date":"2022-06-27T11:11:21","date_gmt":"2022-06-27T18:11:21","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=4219"},"modified":"2022-06-27T11:11:22","modified_gmt":"2022-06-27T18:11:22","slug":"how-to-fix-the-execution-of-scripts-is-disabled-on-this-system-in-powershell","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=4219","title":{"rendered":"How to Fix &#8220;The execution of scripts is disabled on this system&#8221; in PowerShell"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"symptoms\">Symptoms<\/h2>\n\n\n\n<p>When you try to run a script in Microsoft Azure Active Directory Module for Windows PowerShell, you receive one of the following error messages:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>File C:\\my_script.ps1 cannot be loaded. The execution of scripts is disabled on this system. Please see &#8220;Get-Help about_signing&#8221; for more details.<\/p><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>File C:\\Desktop\\myscript.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at&nbsp;<code>http:\/\/go.microsoft.com\/fwlink\/?LinkID=135170<\/code>.<\/p><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>File C:\\my_script.ps1 cannot be loaded. The file C:\\my_script.ps1 is not digitally signed. The script will not execute on the system. For more information, see about_Execution_Policies at&nbsp;<code>http:\/\/go.microsoft.com\/fwlink\/?LinkID=135170<\/code>.<\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"cause\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/troubleshoot\/azure\/active-directory\/cannot-run-scripts-powershell#cause\"><\/a>Cause<\/h2>\n\n\n\n<p>This issue may occur if one of the following factors is true:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The PowerShell version that you are using is higher than 5.1. The Azure Active Directory Module only works with PowerShell 3 to 5.1.<\/li><li>The execution policy is set to&nbsp;<strong>Restricted<\/strong>. Certain Windows PowerShell cmdlets can&#8217;t run if the policy is too restricted.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"resolution\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/troubleshoot\/azure\/active-directory\/cannot-run-scripts-powershell#resolution\"><\/a>Resolution<\/h2>\n\n\n\n<p>To resolve this issue, follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Identify the PowerShell version by running&nbsp;<code>$PSVersionTable<\/code>.<\/li><li>Run the Azure Active Directory Module for Windows PowerShell as an administrator. To do it, select&nbsp;<strong>Start<\/strong>, select&nbsp;<strong>All Programs<\/strong>, select&nbsp;<strong>Windows Azure Active Directory<\/strong>, right-click&nbsp;<strong>Windows Azure Active Directory Module for Windows PowerShell<\/strong>, and then select&nbsp;<strong>Run as administrator<\/strong>.<\/li><li>Set the execution policy to&nbsp;<strong>Unrestricted<\/strong>. To do it, type the following cmdlet, and then press Enter:PowerShellCopy<code>Set-ExecutionPolicy Unrestricted<\/code><\/li><li>Run the Windows PowerShell cmdlets that you want.<\/li><li>Set the execution policy to&nbsp;<strong>Restricted<\/strong>. To do it, type the following cmdlet, and then press Enter:PowerShellCopy<code>Set-ExecutionPolicy Restricted<\/code><\/li><\/ol>\n\n\n\n<p>Ref: https:\/\/docs.microsoft.com\/en-us\/troubleshoot\/azure\/active-directory\/cannot-run-scripts-powershell<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Symptoms When you try to run a script in Microsoft Azure Active Directory Module for Windows PowerShell, you receive one of the following error messages: File C:\\my_script.ps1 cannot be loaded. The execution of scripts is disabled on this system. Please see &#8220;Get-Help about_signing&#8221; for more details. File C:\\Desktop\\myscript.ps1 cannot be loaded because running scripts is <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=4219\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10,1224,14,15],"tags":[1223],"class_list":["post-4219","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-powershell","category-windows-7-8-10","category-windows-servers","tag-the-execution-of-scripts-is-disabled"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4219"}],"version-history":[{"count":2,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4219\/revisions"}],"predecessor-version":[{"id":4221,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4219\/revisions\/4221"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}