none
Error: "File cannot be loaded because the execution of scripts is disabled on this system"

    Question

  • Hello,

    I'm executing powershell scripts from command prompt. I've changed my execution policy to Unrestricted. Also, Get-ExecutionPolicy is showing 'Unrestricted'. When i execute following error

    "File cannot be loaded because the execution of scripts is disabled on this system"

    Reason ?


    Sohaib Khan
    Wednesday, August 10, 2011 12:23 PM

Answers

All replies

  • Is it a 64 bit machine? If so, open the x86 instance of PowerShell and check (set) the execution policy.
    Shay Levy [MVP]
    PowerShay.com
    PowerShell Toolbar
    • Marked as answer by Sohaib Khan Wednesday, August 10, 2011 12:52 PM
    Wednesday, August 10, 2011 12:33 PM
  • Yes, it's a x64 machine and i'm using SharePoint 2010 Management Shell.

    Where can i find x86 instance ?


    Sohaib Khan
    • Proposed as answer by testanicet Wednesday, June 05, 2013 11:54 AM
    • Unproposed as answer by testanicet Wednesday, June 05, 2013 11:54 AM
    Wednesday, August 10, 2011 12:39 PM
  • Yes, it's a x64 machine and i'm using SharePoint 2010 Management Shell.

    Where can i find x86 instance ?


    Sohaib Khan
    %windir%\SysWOW64\WindowsPowerShell\v1.0
    • Proposed as answer by Riyas Hussain Wednesday, June 05, 2013 8:30 AM
    Wednesday, August 10, 2011 12:43 PM
  • Please try this

    Set-ExecutionPolicy Unrestricted

    Wednesday, February 01, 2012 11:27 PM
  • Try with Force switch

    Set-ExecutionPolicy Unrestricted -Force


    Regards Ram
    • Proposed as answer by tarah4 Thursday, April 03, 2014 4:39 PM
    Thursday, February 02, 2012 9:27 AM
  • If I use -Force I get...

    A parameter cannot be found that matches the parameter name 'Force'

    Monday, April 30, 2012 11:07 AM
  • Had the same issue, and this has fixed it for me!

    Seems a bit odd that the system would have different Execution Policies for 32 and 64-bit though doesn't it?

    Thanks for the help!

    • Proposed as answer by Roel Janssens Tuesday, April 15, 2014 7:55 AM
    Friday, June 15, 2012 9:52 AM
  • Running powershell as Administrator and executing "set-ExecutionPolicy Unrestricted" worked for me.
    Thursday, February 20, 2014 6:46 PM
  • Does this option not leave the system unsecure by forever changing the powershell script running option? Where can you programmatically set it to only allow certain scripts to run. Else you just made this computer a beautiful honey jar for a hacker.
    Wednesday, May 07, 2014 9:10 PM
  • Does this option not leave the system unsecure by forever changing the powershell script running option? Where can you programmatically set it to only allow certain scripts to run. Else you just made this computer a beautiful honey jar for a hacker.

    If you only want certain scripts to run, you'll need to sign them and leave the policy as Restricted.

    I use RemoteSigned personally. You may also want to research Bypass.


    Don't retire TechNet! - (Don't give up yet - 12,830+ strong and growing)

    Wednesday, May 07, 2014 10:24 PM
  • Running powershell as Administrator and executing "set-ExecutionPolicy Unrestricted" worked for me.

    It worked for me too, thanks!
    Thursday, May 15, 2014 3:31 PM
  • Changing the powershell execution policy allowed me to run scripts on my windows Azure Server.

    This is heaps better now I can run my own scripts.


    Regards Jake Gardner If you found this post helpful, please give it a "Helpful" vote. If it answered your question, remember to mark it as an "Answer". This posting is provided "AS IS" with no warranties and confers no rights! Always test ANY suggestion in a test environment before implementing! Sorry if my grammar is incorrect as I am probably on writing to you from my phone.

    Monday, May 26, 2014 12:08 PM
  • Worked ... thanks...
    Tuesday, July 15, 2014 1:09 PM