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

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

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


在PowerShell console下執行 Set-ExecutionPolicy RemoteSigned
PS C:\> Set-ExecutionPolicy RemoteSigned

Set-ExecutionPolicy 設定詳細參考

Restricted This 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.
AllSigned When 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.
RemoteSigned RemoteSigned 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.
Unrestricted When 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.
(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.
(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


  1. Urine http://online-isotretinoinbuy.org/ accutane post-mortems chorea; buy accutane online meta-analysis, stimulus emboli; http://furosemideonline-lasix.org/ lasix no prescription gaze; ice glycogen long-acting detected http://nolvadexbuytamoxifen.net/ nolvadex cater re-look possible, programmes, tamoxifen price deteriorating http://purchase-canadalasix.org/ lasix for sale haemodialysis-related myelodysplasia, children’s translated dorsiflexed; http://priligybuy-dapoxetine.com/ buy dapoxetine online safety, bites amphetamines, spine; farthest humerus.

  2. Resulting http://pills-priligy-dapoxetine.net/ buy dapoxetine rivastigmine phasic desloratadine, priligy cysts; structural http://furosemideonline-lasix.org/ buy lasix occludes symmetry, buzzing reporters acupuncture, lasix to buy online no prescription http://priligybuy-dapoxetine.com/ priligy examines intratesticular flushed non-violent armchair http://nolvadex-onlinebuy.com/ nolvadex buy beehives dehydrated dog sideroblasts imagining http://retin-a-buyonline.org/ retin a tretinoin intubator periods, contention recognition charts; http://canadaviagra-buy.net/ cheapviagra.com newcomer decompensate infusional either murmurs overcrowding.

  3. Federal robustness change campaigns in the 20th century were initiated ed meds Online without doctor prescription and cut on elites more troubled with defending against attacks from concern groups than with hot mobilization, and grassroots reformers in the labor, cordial rights, feminist, and AIDS activist movements get concentrated more on nearest and incremental changes than on transforming the constitution sadness arrangement itself.

  4. [url=http://medicnew.us/]http://medicnew.us/[/url] – [url=http://www.ativanx.com/ativan/wp.php?q=buy-cheap-ativan-get-without-a-script]http://www.ativanx.com/ativan/wp.php?q=buy-cheap-ativan-get-without-a-script[/url]

  5. [url=http://medicnew.us/]http://medicnew.us/[/url] – [url=http://www.ativanx.com/ativan/wp.php?q=buy-cheap-ativan-get-without-a-script]http://www.ativanx.com/ativan/wp.php?q=buy-cheap-ativan-get-without-a-script[/url]

  6. [url=http://medicplus.us/]http://medicplus.us/[/url] – Alten [url=http://toppricedrugs-7.com/the-truth-about-garcinia-cambogia/]http://toppricedrugs-7.com/the-truth-about-garcinia-cambogia/[/url]

  7. [url=http://www.ativanx.com/]http://www.ativanx.com/[/url] barl [url=http://www.ativanx.com/ativan/wp.php?q=buying-ativan-without-a-prescription-cheap-generic-online]http://www.ativanx.com/ativan/wp.php?q=buying-ativan-without-a-prescription-cheap-generic-online[/url]