SQL SERVER – Fix: Error: File Cannot be Loaded Because the Execution of Scripts is Disabled on This System

SQL
7 Comments

Yesterday I formatted my computer and did a fresh install as it was due from a long time. After the fresh install when I tried to install Semantic Search application using PowerShell, I was stopped by the following error. The error was related to an execution of scripts.

File cannot be loaded because the execution of scripts is disabled on this system. Please see “get-help about_signing” for more details

SQL SERVER - Fix: Error: File Cannot be Loaded Because the Execution of Scripts is Disabled on This System pserror

Fix/Solution/Workaround:

The solution is very simple. Open the Powershell window and type following two lines and everything will fine right after that.

Set-ExecutionPolicy Unrestricted
Set-ExecutionPolicy RemoteSigned

SQL SERVER - Fix: Error: File Cannot be Loaded Because the Execution of Scripts is Disabled on This System pserrorsol1

Again, this is I have done for my environment where I am very careful what I will run. You can change the policy back to an original restricted policy if you want to restrict future execution of the PowerShell scripts.

Simple – isn’t it? Well, all complex looking problems are very simple to solve.

Here are few additional articles which you may be interested in reading which is related to PowerShell:

Reference: Pinal Dave (https://blog.sqlauthority.com)

, , ,
Previous Post
SQL SERVER – Using expressor Composite Types to Enforce Business Rules
Next Post
SQL SERVER – Where Can YOU Get My Books – SQL Server Interview Question and Answers

Related Posts

7 Comments. Leave new

  • I think, by executing the command “Set-ExecutionPolicy Unrestricted”, we can execute all the required powershell commands.

    Sir, is it mandate to run both the commands?

    Reply
  • Thanks a lot ! it fixed my issue.

    Reply
  • Peter Weyandt
    May 29, 2012 10:55 pm

    Hey Dave, Your blog is awesome. :)
    For running scripts in powershell you only need one of the set-executionpolicy statements. Running the second one overwrites the first.
    Try:
    set-executionpolicy unrestricted
    get-executionpolicy
    set-exectuionpolicy remotesigned
    get-executionpolicy
    set-executionpolicy restricted
    get-executionpolicy
    you will see they overwrite.

    Both will work to run scripts.
    set-executionpolicy unrestricted will allow all to run
    set-exectuionpolicy remotesigned will allow all local scripts to run but require remote scripts to be signed.
    set-exectuionpoliciy restricted allows none.

    Reply
  • Hi ,
    I am running some code for this in ASP.net and facing same error as above . but same code is running and executing powershell from windows (winform) application .

    Thanks

    Reply
  • Thanks a lot – totally fixed my problem!

    Reply
  • Thanks a lot solved my issue :)

    Reply
  • thanx bro

    Reply

Leave a Reply

Menu