PowerShellのインストール

お約束のエラー

Monad Beta3.1をアンインストールしてPowerShellをインストール。
スタートメニューから「Windows PowerShell」をクリック。

Windows(R) PowerShell
Copyright (C) 2006 Microsoft Corporation. All rights reserved.

Error loading the extended type data file:
Microsoft.PowerShell.Core, C:\Program Files\Windows PowerShell\v1.0\types.ps1xml
: File skipped because of validation exception: "The file C:\Program Files\Wind
ows PowerShell\v1.0\types.ps1xml cannot be loaded. The execution of scripts is d
isabled on this system. Please see "get-help about_signing" for more details.".
(中略)

お約束です。(^^;
「実行ポリシー」が「Restricted」のためのエラーです。
※参考:Monad Beta3 Release - PowerShell Memo


実行ポリシーがデフォルトの「Restricted」では制限が厳しすぎるので「RemoteSigned」に変更しましょう。

新しいCmdlet:Set-ExecutionPolicy / Get-ExecutionPolicy

ところで、PowerSHellでは、実行ポリシーを変更するための便利なCmdletが追加されています。

  • Set-ExecutionPolicy
    • 実行ポリシーを変更する
  • Get-ExecutionPolicy
    • 実行ポリシーを取得する

では、早速。

Set-ExecutionPolicy RemoteSigned

これだけで、実行ポリシーを「RemoteSigned」に変更できます。
便利ですねえ。