VS Code Terminal — UnauthorizedAccess on Command Execution
This post explains how to fix the permission error you get when running commands in the Visual Studio Code Terminal (PowerShell).
[01] The Error
- “Cannot be loaded because running scripts is disabled on this system…”
- Security error, PSSecurityException
- FullyQualifiedErrorID, UnauthorizedAccess
1
2
3
4
PS D:\Code\Python> .\.venv-doit-django\Scripts\activate
.\.venv-doit-django\Scripts\activate : 이 시스템에서 스크립트를 실행할 수 없으므로 ...
+ CategoryInfo : 보안 오류: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess

[02] Cause and Solution
-
PowerShellis configured by default to disallow running script files. - Possible values
| Value | Description |
|---|---|
Restricted |
default, scripts cannot be run |
AllSigned |
only signed (trusted) scripts run |
RemoteSigned |
locally created scripts and signed scripts run |
Unrestricted |
all scripts can run |
ByPass |
all scripts run with no warning or block |
Undefined |
no policy set |
2-1. On Windows 10
Search bar →
PowerShell→ Run as Administrator → Change script execution policy

1
2
3
4
5
# Check the current policy
get-ExecutionPolicy
# Set the policy (RemoteSigned)
Set-ExecutionPolicy RemoteSigned

[03] Verifying After the Change
- You can confirm that the script file (here, a Python virtual environment) now runs correctly.
