* PowerShellCommunityExtension 2のインストール[#t82d6964]
* PowerShell Community Extensions 2のインストール[#t82d6964]


** 手順 [#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フォルダを上のフォルダの中にコピーする。

*** スクリプトの実行ポリシーを変更する [#w439226c]
 Set-ExecutionPolicy RemoteSigned
 Get-ExecutionPolicy

*** PowerShell設定ファイルを変更する [#i6a1de66]
C:\Users\taro\Documents\WindowsPowerShellにMicrosoft.PowerShell_profile.ps1というファイルを作り、以下のように記述する。
 import-module pscx
ユーザ設定ファイルを利用する場合は以下のようにする。
 import-module Pscx -arg $(Join-Path -Path $profile -ChildPath "..\Pscx.UserPreferences.ps1")  

** スクリプトの実行ポリシーを変更せずに自分で署名する場合 [#i84861b9]
*** 事前準備 [#rb56d3d3]
Makecert.exeが必要なので、Visual Studioをインストールする。

*** 鍵の作成 [#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
- http://www.atmarkit.co.jp/fwin2k/win2ktips/1023ps1sec/ps1sec.html

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS