about_Execution_Policies

https://technet.microsoft.com/en-us/library/hh847748.aspx?f=255&MSPPError=-2147217396

在powershell中执行命令

Get-ExecutionPolicy -List

 

此命令也可以使用tab键进行辅助

Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined

 

 

查询指定的Scope的ExecutionPolicy

 Get-ExecutionPolicy -Scope CurrentUser

 Get-ExecutionPolicy CurrentUser

 

 

CHANGE YOUR EXECUTION POLICY
 ------------------------------
    To change the Windows PowerShell execution policy on your
    computer, use the Set-ExecutionPolicy cmdlet. 

    The change is effective immediately; you do not need to restart
    Windows PowerShell. 

    If you set the execution policy for the local computer (the default)
    or the current user, the change is saved in the registry and remains
    effective until you change it again.

    If you set the execution policy for the current process, it is 
    not saved in the registry. It is retained until the current
    process and any child processes are closed. 

    
    Note: In Windows Vista and later versions of Windows, to run
          commands that change the execution policy for the local
          computer (the default), start Windows PowerShell with the
          "Run as administrator" option.
    

    To change your execution policy, type:
 
        Set-ExecutionPolicy -ExecutionPolicy <PolicyName>

    For example: 

        Set-ExecutionPolicy -ExecutionPolicy RemoteSigned



    To set the execution policy in a particular scope, type:

        Set-ExecutionPolicy -ExecutionPolicy <PolicyName> -Scope <scope>

    For example: 

        Set-ExecutionPolicy RemoteSigned -Scope CurrentUser


    A command to change an execution policy can succeed but
    still not change the effective execution policy.

    For example, a command that sets the execution policy for
    the local computer can succeed but be overridden by the 
    execution policy for the current user.
    

示例:

 Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

设置完成后,可以用上面的命令进行查看

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值