参考:http://technet.microsoft.com/en-us/library/bb613481%28v=vs.85%29.aspx
Powershell勉強のメモ。
スクリプトの実行はデフォルトでは禁止されていて、
Powershellを「管理者で実行」で開いて、以下のコマンドを実行する。
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
え、RemoteSinedって、ローカルで書いたスクリプトも署名がないと使えないの??
とか英語読むのめんどくさくて勝手に勘違いしてたけど、
ローカルで書いたやつは大丈夫らしいです。
ちゃんと読めって話ですね。すみません。
PS C:\Users\user1> Get-Help about_Execution_Policies | more
...
RemoteSigned
- Scripts can run. This is the default execution
policy in Windows Server 2012 R2.
- Requires a digital signature from a trusted
publisher on scripts and configuration files that
are downloaded from the Internet (including
e-mail and instant messaging programs).
- Does not require digital signatures on scripts that
you have written on the local computer (not
downloaded from the Internet).
- Runs scripts that are downloaded from the Internet
and not signed, if the scripts are unblocked, such
as by using the Unblock-File cmdlet.
- Risks running unsigned scripts from sources other
than the Internet and signed, but malicious, scripts.