茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1673456 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
IMG_60D_00114.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

微軟帝國 : [轉貼]Powershell 檔案無法載入,因為這個系統上已停用指令碼執行。

發表者 討論內容
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15771
[轉貼]Powershell 檔案無法載入,因為這個系統上已停用指令碼執行。

Powershell 檔案無法載入,因為這個系統上已停用指令碼執行。

Posted on 2012年七月25日 by

Powershell 執行 ps1 檔時出現: 檔案無法載入,因為這個系統上已停用指令碼執行。如需詳細資訊,請參閱 “get-help about_signing"。

原因是第一次在電腦上啟動 Windows PowerShell 時,可能會實行 Restricted 執行原則 (預設值)。Restricted 原則不會允許任何指令碼執行。

若要允許執行已簽署的指令碼

在PowerShell console下執行 Set-ExecutionPolicy RemoteSigned


PS C:\> Set-ExecutionPolicy RemoteSigned

Set-ExecutionPolicy 設定詳細參考




RestrictedThis is the default execution policy upon installation. When this policy is in effect, script execution is disabled. This includes script modules, profile files and types, and format files. PowerShell itself isn’t disabled and may still be used as an interactive command interpreter. Although this is the most secure policy, it severely impacts your ability to use PowerShell for automation.
AllSignedWhen the execution policy is AllSigned, scripts can be executed but they must be Authenticode-signed before they’ll run. When running a signed script, you’ll be asked if you want to trust the signer of the script. Section 21.4 covers the details of script signing. AllSigned is still a secure policy setting, but it makes script development difficult. In an environment where scripts will be deployed rather than created, this is the best policy.
RemoteSignedRemoteSigned requires that all scripts that are downloaded from a remote location be Authenticode-signed before they can be executed. Note that this depends on whether the application doing the download marks the script as coming from a remote location. Not all applications do this. Anything downloaded by Internet Explorer 6.0 or above, Outlook, or Outlook Express will be properly marked. RemoteSigned is the minimum recommended execution policy setting. It’s the best policy setting for script development.
UnrestrictedWhen the execution policy is Unrestricted, PowerShell will run any script. It will still prompt the user when it encounters a script that has been downloaded. Unrestricted is the least secure setting. We don’t recommend that you use this setting, but it may be necessary in some developer scenarios where RemoteSigned is still too restrictive.
Bypass
(v2 only)
Nothing is blocked and there are no warnings or prompts. This execution policy is designed for configurations in which PowerShell scripts are part of a larger application that has its own security model. The Windows Diagnostics feature in Windows 7 is a good example of this type of application.
Undefined
(v2 only)
Removes the currently assigned execution policy from the current scope. This parameter won’t remove an execution policy that’s set in a Group Policy scope (User scope or Machine scope).

節錄至:chapter 21, Security, security, security, Windows PowerShell in Action, Second Edition
參考:


原文出處: Powershell 檔案無法載入,因為這個系統上已停用指令碼執行。 | Taien's blog
前一個主題 | 下一個主題 | | | |

討論串




Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|