Problema con Scripts en Visual Studio Code

Question:

As soon as I open Visual Studio Code, the following appears in VSCode's own console:

. : No se puede cargar el archivo C:\Users\admin\Documents\WindowsPowerShell\profile.ps1 
porque la ejecución de scripts está deshabilitada en este sistema. Para obtener más 
información, consulta el tema about_Execution_Policies en 
https:/go.microsoft.com/fwlink/?LinkID=135170.
En línea: 1 Carácter: 3
+ . 'C:\Users\admin\Documents\WindowsPowerShell\profile.ps1'
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
Cargar los perfiles personales y de sistema tardó 643ms.

I don't know if it will have anything to do with it or not, but a few hours before I had installed node, npm and typescript (although I did update them, since I had them from before).

The issue and my urgency in this problem is that I am doing a JavaScript course where TypeScript is used in a section. So that was the reason I started updating those "tools".

Also, given a moment of the course I have to execute the following script:

tsc clase148.ts

I get the following error:

tsc : No se puede cargar el archivo C:\Users\admin\AppData\Roaming\npm\tsc.ps1 porque la 
ejecución de scripts está deshabilitada en este sistema. Para obtener más información, 
consulta el tema about_Execution_Policies en 
https:/go.microsoft.com/fwlink/?LinkID=135170.
En línea: 1 Carácter: 1
+ tsc clase148.ts
+ ~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

Enter the link:

About Execution Policies

But honestly, I don't know what to do.

It should be clarified that executing the previous script, from tsc, in a Windows 10 command line, it executes it well and without problems.

How do I fix this error, problem?

Answer:

I already fixed it, you need to run the powershell as administrator and run the command Set-ExecutionPolicy Unrestricted

Scroll to Top