I'm trying to run a .ps1 file from Developer Powershell for VS 2019 and this is what I get:
PS C:\Users\name\Documents\GitHub\proj> ./test.ps1
./test.ps1 : File C:\Users\name\Documents\GitHub\proj\test.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
+ ./test.ps1
+ ~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
I've followed the steps at https://stackoverflow.com/a/68381260 and I can run a .ps1 file in normal PowerShell, just not in Developer Powershell for VS 2019. Is there some trick to this, or it blocked for a reason? This is the output of Get-ExecutionPolicy -List from Developer Powershell for VS 2019:
PS C:\Users\name\Documents\GitHub\proj> Get-ExecutionPolicy -List
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined
Set-ExecutionPolicyin your developer PowerShell or in your regular PowerShell?powershell -ExecutionPolicy ByPass -File ./test.ps1instead of./test.ps1.