濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > PowerShell因?yàn)樵诖讼到y(tǒng)中禁止執(zhí)行腳本的解決方法

PowerShell因?yàn)樵诖讼到y(tǒng)中禁止執(zhí)行腳本的解決方法

熱門(mén)標(biāo)簽:金融電銷(xiāo)公司怎么辦理外呼系統(tǒng) 真人和電話機(jī)器人對(duì)話 雷霆電話機(jī)器人電話 湖州電銷(xiāo)防封卡 使用電話機(jī)器人電銷(xiāo)是否違法 信陽(yáng)話務(wù)外呼系統(tǒng)怎么收費(fèi) 什么渠道可以找外呼系統(tǒng)客戶 安徽400電話辦理 電話智能外呼系統(tǒng)誠(chéng)信合作

在Powershell直接腳本時(shí)會(huì)出現(xiàn):

無(wú)法加載文件 ******.ps1,因?yàn)樵诖讼到y(tǒng)中禁止執(zhí)行腳本。有關(guān)詳細(xì)信息,請(qǐng)參閱 "get-help about_signing"。
所在位置 行:1 字符: 17
+ E:\Test\test.ps1
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException

ps1的內(nèi)容:

在powershell中執(zhí)行 set-ExecutionPolicy RemoteSigned

下圖可以看到原來(lái)是無(wú)法運(yùn)行對(duì)的,執(zhí)行了上面的命令后就可以了,如下圖

查看“get-help about_signing”:

主題
about_signing

簡(jiǎn)短說(shuō)明
說(shuō)明如何對(duì)腳本進(jìn)行簽名以使其符合 Windows PowerShell 執(zhí)行策略。

詳細(xì)說(shuō)明
Restricted 執(zhí)行策略不允許任何腳本運(yùn)行。
AllSigned 和 RemoteSigned 執(zhí)行策略可防止 Windows PowerShell 運(yùn)行沒(méi)有數(shù)字簽名的腳本。

本主題說(shuō)明如何運(yùn)行所選未簽名腳本(即使在執(zhí)行策略為 RemoteSigned 的情況下),還說(shuō)明如何對(duì)
腳本進(jìn)行簽名以便您自己使用。

有關(guān) Windows PowerShell 執(zhí)行策略的詳細(xì)信息,請(qǐng)參閱 about_Execution_Policy。

允許運(yùn)行簽名腳本
-------------------------------
首次在計(jì)算機(jī)上啟動(dòng) Windows PowerShell 時(shí),現(xiàn)用執(zhí)行策略很可能是 Restricted(默認(rèn)設(shè)置)。

Restricted 策略不允許任何腳本運(yùn)行。

若要了解計(jì)算機(jī)上的現(xiàn)用執(zhí)行策略,請(qǐng)鍵入:

get-executionpolicy

若要在本地計(jì)算機(jī)上運(yùn)行您編寫(xiě)的未簽名腳本和來(lái)自其他用戶的簽名腳本,請(qǐng)使用以下命令將計(jì)算機(jī)上的
執(zhí)行策略更改為 RemoteSigned:

set-executionpolicy remotesigned

有關(guān)詳細(xì)信息,請(qǐng)參閱 Set-ExecutionPolicy。

執(zhí)行“set-ExecutionPolicy RemoteSigned ”:

執(zhí)行策略更改
執(zhí)行策略可以防止您執(zhí)行不信任的腳本。更改執(zhí)行策略可能會(huì)使您面臨 about_Execution_Policies
幫助主題中所述的安全風(fēng)險(xiǎn)。是否要更改執(zhí)行策略?
[Y] 是(Y) [N] 否(N) [S] 掛起(S) [?] 幫助 (默認(rèn)值為“Y”): y

Run a CMD batch file

To run a batch script from the CMD shell, save the file as plain ASCII text with the file extension .CMD, then from the command line, enter the name of the script and press return.

C:\Batch> Demo.cmd

To run a batch file from within another batch file, use the CALL command, otherwise the first script will exit without performing any further commands.

It is also possible to run batch scripts with the old (Windows 95 style) .BAT extension, but be aware that these will set ERRORLEVEL differently.

Run a Powershell script
To run a PowerShell script from the CMD shell:

復(fù)制代碼 代碼如下:

C:\&; powershell -file "c:\batch\demo.ps1"

Run a VBScript file

To run a VBScript from the CMD shell:

復(fù)制代碼 代碼如下:

C:\&; cscript c:\batch\demo.vbs

“The method of the enterprising is to plan with audacity and execute with vigor” ~ John Christian Bovee

標(biāo)簽:岳陽(yáng) 運(yùn)城 山南 鶴崗 湛江 德州 六盤(pán)水 濟(jì)南

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《PowerShell因?yàn)樵诖讼到y(tǒng)中禁止執(zhí)行腳本的解決方法》,本文關(guān)鍵詞  PowerShell,因?yàn)?在此,系統(tǒng),;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《PowerShell因?yàn)樵诖讼到y(tǒng)中禁止執(zhí)行腳本的解決方法》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于PowerShell因?yàn)樵诖讼到y(tǒng)中禁止執(zhí)行腳本的解決方法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    昭苏县| 钦州市| 乌鲁木齐市| 拜城县| 准格尔旗| 朝阳区| 呼和浩特市| 景德镇市| 宿松县| 瑞金市| 工布江达县| 嘉禾县| 象山县| 普安县| 绥化市| 徐闻县| 淮北市| 冕宁县| 鞍山市| 醴陵市| 汶川县| 田阳县| 四川省| 天气| 丰城市| 富裕县| 德江县| 江油市| 桑植县| 鹰潭市| 河北省| 普安县| 胶州市| 武安市| 苍梧县| 曲阳县| 内乡县| 玉屏| 卢湾区| 东宁县| 罗山县|