ProgramingTip

Windows 7의 PowerShell : 일반 사용자를위한 Set-ExecutionPolicy

bestdevel 2020. 12. 6. 21:53
반응형

Windows 7의 PowerShell : 일반 사용자를위한 Set-ExecutionPolicy


Windows 7에서 일반 사용자로 PowerShell 펼쳐보기를 실행하고 싶습니다. 시도 할 때마다 다음 오류가 발생합니다.

File C:\Users\danv\Documents\WindowsPowerShell\profile.ps1 cannot be loaded because the
execution of scripts is disabled on this system. Please see "get-help about_signing" for
more details.
At line:1 char:2
+ . <<<<  'C:\Users\danv\Documents\WindowsPowerShell\profile.ps1'
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

를 시도 해결 시도 Set-ExecutionPolicy Unrestricted실패 :

PS C:\Users\danv> Set-ExecutionPolicy Unrestricted
Set-ExecutionPolicy : Access to the registry key
'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell'
is denied.
At line:1 char:20
+ Set-ExecutionPolicy <<<<  Unrestricted
    + CategoryInfo          : NotSpecified: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand

Set-ExecutionPolicy Unrestricted권한으로 명령 관리자을 실행할 수 있지만 관리자가 아닌 user-에게 전파되지 않는을 구석으로 같습니다.

확장해야하는 확장해야합니까?


귀하 (또는 유용한 관리자)가 Set-ExecutionPolicy관리자로 실행 하는 경우 모든 user-에 대해 정책이 설정됩니다. (안전 조치로 "unrestricted"보다는 "remoteSigned"를 제안합니다.)

참고 : 64 비트 OS Set-ExecutionPolicy에서는 32 비트 및 64 비트 PowerShell을 맨 위에 있어야합니다 .


Set-ExecutionPolicy Unrestricted -Scope CurrentUser

이렇게하면 로컬 컴퓨터 (HKEY_LOCAL_MACHINE)가 아닌 현재 사용자 (HKEY_CURRENT_USER에 저장 됨)에 대한 실행 정책이 설정됩니다. 컴퓨터에 대한 관리 권한이없는 경우 유용합니다.


이렇게하면 문제가 해결됩니다. 다음을 실행해야합니다.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser 

참고 URL : https://stackoverflow.com/questions/4647429/powershell-on-windows-7-set-executionpolicy-for-regular-users

반응형