0

I am trying to run virtualenv script to activate it on powershell using:

.\env\Scripts\activate.ps1

but I get this error:

.\env\Scripts\activate.ps1 : File C:\Users\user\Desktop\tranning\env\Scripts\activate.ps1 cannot be loaded because running scripts is disabled on this 
system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\env\Scripts\activate.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

I read this article and I tried to solve this by running powershell as administrator and type this command:

Set-ExecutionPolicy RemoteSigned 

but unfortunately nothing change

Amir Makram
  • 12,030
  • 3
  • 13
  • 25
  • What message did you get after running `Set-ExecutionPolicy RemoteSigned `? Did you try `Unrestricted`? – Nick.Mc Dec 02 '19 at 06:42
  • I get nothing. and yes I did and I get this message: Set-ExecutionPolicy: PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope. Due to the override, your shell will retain its current effective execution policy of RemoteSigned. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information please see "Get-Help Set-ExecutionPolicy". – Amir Makram Dec 02 '19 at 07:43
  • @AmirMakram just to confirm, are you a local/domain admin and you are running PS/ISE as admin too? – Matthew Dec 02 '19 at 08:34
  • @Matthew yes I did – Amir Makram Dec 02 '19 at 09:56

1 Answers1

0

According to this earlier asked question there are a few other things you can try: PowerShell says "execution of scripts is disabled on this system."

To summarize from the link:

  1. If you are running from a windows server make sure you set the execution policy on all versions of powershell that you have on the system(both x64 x86 versions of powershell)

OR

  1. Run the following to bypass the Execution Policy:

powershell -ExecutionPolicy ByPass -File script.ps1