[Solved] Running scripts is disabled on this system

I run this code to execute PowerShell code from an react native application:

Solved by :

  1. Run powershell as adminstrator
  2. Check excecution policy by running:
    Get-ExecutionPolicy
  3. Then u will see ‘Restricted’, means the main reason to run ur script been restricted
  4. To change this policy, can run :
    Set-ExecutionPolicy Unrestricted
  5. Then fixed, u can run ur script again