Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting is overridden by a

 policy defined at a more specific scope.  Due to the override, your shell will retain its current effective execution

policy of Unrestricted. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information p

lease see "Get-Help Set-ExecutionPolicy".

At line:1 char:1

+ Set-ExecutionPolicy “RemoteSigned” -Scope CurrentUser -Confirm:$false

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : PermissionDenied: (:) [Set-ExecutionPolicy], SecurityException

    + FullyQualifiedErrorId : ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand


그냥 콘솔에서 실행할 때는 에러가 나지 않았지만

오른쪽클릭 후 powershell 실행 후에는 위와 같은 에러가 났다.

> Get-ExecutionPolicy -List

아무래도 MachinePolicy 가 허용안됨으로 되있어서 그런듯 하여

( 다른항목은 userpolicy / currentuser 등 모두 undefined로 변경해도 동일한 증상이었기 때문에 )

해당 값을 변경하려 했으나 다시 오류

그룹정책을 먼저 변경해 줘야 한다고 한다.....

그래서 그룹정책을 변경하기 위해

command 창을 켜고 ( win + r )

gpedit.msc

컴퓨터 구성> 관리 템플릿> Windows 구성 요소> Windows PowerShell

 Computer Configuration > Administrative Templates > Windows Components > Windows PowerShell

위 경로로 이동한다

그리고 Not Configured 에서 Enabled 로 변경해주고 Apply 한다.

그리고 레지스트르 값을 변경하기 위해

Set-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\PowerShell -Name ExecutionPolicy -Value Bypass

명령어 실행 후 다시 확인해보면 값이 변경되있다.

그리고 다시 파워쉘 스크립트를 실행해 보면 정상실행~!




,