PowerShell failed, it can not be initialized, file locked by software restriction policies, how to fix?

0

I was using the package manager console in Visual Studio 2015, when I opened the powershell appeared a message if I wanted to run it in an unreliable source file, I clicked yes on this message showed more a 3 times, I clicked on the three times and then this other message appeared.

Translating to Portuguese the summarized message is this:

  

The shell can not be started, a crash occurred during startup: Errors occurred while loading Microsoft.Powershell.Core, C: \ windows ... \ certificate.format.ps1.xml format data files, the file was ignored because of the following validation exception: The C: \ windows ... \ certificate.format.ps1.xml file can not be loaded by software restriction policies such as those created with Group Policy

How to fix this problem?

    
asked by anonymous 13.06.2016 / 00:28

1 answer

0

The default PowerShell execution policy is somewhat restrictive, you can see which constraint policy is active with the cmdlet

Get-ExecutionPolicy

And you can use the Set-ExecutionPolicy cmdlet to change it

Set-ExecutionPolicy RemoteSigned

RemoteSigned works in most cases, it is only more restrictive than Unrestricted .

Note: Do not forget to open PowerShell as an administrator.

More details on Using the Set-ExecutionPolicy Cdmlet (en)

    
13.06.2016 / 00:59