* PowerShellCommunityExtensionのインストール[#t82d6964]
** 事前準備 [#rb56d3d3]
Makecert.exeが必要なので、Visual Studioをインストールする。
** 手順 [#e73724f2]
*** Pscxのダウンロードと設置 [#sbfd7b73]
- http://pscx.codeplex.com/からPscx-2.0.0.1.zipダウンロードする。
- Pscx-2.0.0.1.zipを右クリックして、ブロック解除ボタンをクリックする。
- マイドキュメント以下に下のようなフォルダを作る。
C:\Users\taro\Documents\WindowsPowerShell\Modules
- Pscx-2.0.0.1.zipを展開して出来たPscxフォルダを上のフォルダの中にコピーする。
*** 鍵の作成 [#uc90e215]
- スタートメニューから[Visual Studio]→[Visual Studio tools]→[Visual Studio コマンドプロンプト]を選び、右クリックして管理者として実行する。
- 以下のようにして鍵を作成する。
cd %USERPROFILE%
makecert -n "CN=PowerShell Local Certificate Root" `
-a sha1 -eku 1.3.6.1.5.5.7.3.3 -r -sv root.pvk root.cer -ss Root - sr localMachine
makecert -pe -n "CN=PowerShell User" -ss MY -a sha1 `
-eku 1.3.6.1.5.5.7.3.3 -iv root.pvk -ic root.cer
*** スクリプトの署名 [#q36b1940]
- PowerShellを管理者として実行する。
- 署名する為のツールスクリプトを作成する。パスの通った場所に以下のようなスクリプトファイルadd-sinature.ps1を作成する。
param([string] $file=$(throw "Please specify a filename."))
$cert = @(Get-ChildItem cert:\CurrentUser\My -codesigning)[0]
Set-AuthenticodeSignature $file $cert
- 以下のようにしてadd-sinature.ps1を署名する。
$cert = @(Get-ChildItem cert:\CurrentUser\My -codesigning)[0]
Set-AuthenticodeSignature add-signature.ps1 $cert
** 参考 [#o14007c5]
get-help about_signing