zoukankan      html  css  js  c++  java
  • [转]Powershell中禁止执行脚本解决办法

    刚开始使用Powershell,导入管理模块或者其他操作的时候会出现因为在此系统中禁止执行脚本的报错,报错内容如下:

    Windows PowerShell
    版权所有 (C) 2009 Microsoft Corporation。保留所有权利。

    PS C:Windowssystem32> D:WorkshopPowershellSprinklersrcScriptsSPRINKLE.ps1
    无法加载文件 D:WorkshopPowershellSprinklersrcScriptsSPRINKLE.ps1,因为在此系统中禁止执行脚本。有关详细信息,请参
    "get-help about_signing"
    所在位置 行:1 字符: 58
    + D:WorkshopPowershellSprinklersrcScriptsSPRINKLE.ps1 <<<<
    + CategoryInfo : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

    PS C:Windowssystem32> get-ExecutionPolicy
    Restricted

    果然,是被限制。还是在"get-help about_signing"里面可以查到设置命令"set-executionpolicy"
    再在帮助中找到"set-executionpolicy"的说明。。似乎是比较建议设置为,至少是被标记为可信任的

    -- RemoteSigned: Requires that all scripts and configuration files downloaded from the Internet be signed by a trusted publisher.
    在PowerShell执行以下:
    PS C:Windowssystem32> set-ExecutionPolicy RemoteSigned

    执行策略更改
    执行策略可以防止您执行不信任的脚本。更改执行策略可能会使您面临 about_Execution_Policies
    帮助主题中所述的安全风险。是否要更改执行策略?
    [Y] 是(Y)  [N] 否(N)  [S] 挂起(S)  [?] 帮助 (默认值为“Y”): y
    PS C:Windowssystem32>


    ---------------------
    作者:张善友
    来源:CNBLOGS
    原文:https://www.cnblogs.com/shanyou/archive/2011/09/03/2165371.html
    版权声明:本文为作者原创文章,转载请附上博文链接!

  • 相关阅读:
    ECharts之柱状图 饼状图 折线图
    Vue自定义指令(directive)
    HDU 1231 最大连续子序列
    POJ 2533 Longest Ordered Subsequence
    HDU 1163 Eddy's digital Roots
    HDU 2317 Nasty Hacks
    HDU 2571 命运
    HDU 4224 Enumeration?
    HDU 1257 最少拦截系统
    HDU 2740 Root of the Problem
  • 原文地址:https://www.cnblogs.com/vilogy/p/12330951.html
Copyright © 2011-2022 走看看