Just started using Powershell, import management module or other operations when an error occurs because the script execution is prohibited in this system, being given as follows:
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. all rights reserved.
PS C: \ Windows \ system32> D: \ Workshop \ Powershell \ Sprinkler \ src \ Scripts \ SPRINKLE.ps1
Could not load file D: \ Workshop \ Powershell \ Sprinkler \ src \ Scripts \ SPRINKLE.ps1, since the prohibition in this system execute the script. For more information, see
reading "GET-Help about_signing" .
Location by: Character 1: 58
+ D: \ Workshop \ Powershell \ Sprinkler \ the src \ the Scripts \ SPRINKLE.ps1 <<<<
+ CategoryInfo: NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId: a RuntimeException
PS C:\Windows\system32> get-ExecutionPolicy
Restricted
Sure enough, it is to be restricted. Or in the " GET-Help about_signing " which can be found in Settings command " set-executionpolicy "
re-found "in the Help set-executionpolicy description" of. . Compare suggestion seems to be set to at least be marked as trusted
-- RemoteSigned: Requires that all scripts and configuration files downloaded from the Internet be signed by a trusted publisher.
在PowerShell执行以下:
PS C:\Windows\system32> set-ExecutionPolicy RemoteSigned
Change the execution policy
execution policy prevents scripts that you do not trust. Change the execution policy may make you face about_Execution_Policies
security risks in the Help topic. Do you want to change the execution policy?
[The Y-] is (Y) [N] No (N) [S] Suspend (S) help (the default is "the Y-") [?]: The y-
PS C: \ Windows \ system32>
---------------------
Author: Zhang Shanyou
Source: CNBLOGS
Original: https: //www.cnblogs.com/shanyou/archive/2011/09/03/2165371 .html
Disclaimer: This article is the author original article, reproduced, please attach Bowen link!