Why it doesn't work?

作業のメモ、記録をブログに残しています。

Windows PowerShellをバージョンアップする

Vagrantによる環境構築(番外編) vagrant up でエラーが発生する。 - Why it doesn't work?
PowerShellのバージョンが低すぎると怒られたので、バージョンアップしたいと思います。


Installing Windows PowerShell | Microsoft Docs からの引用です。

PowerShell のインストール パッケージは、WMF インストーラー内に含まれています。 WMF インストーラーのバージョンは、PowerShell のバージョンに一致します。Windows PowerShell に、スタンドアロンインストーラーはありません。

というわけで、Windows Management Frameworkのアップデートが必要なようです。
各OSのバージョンサポートは以下の通りです(2018/04/19 現在)。

Windows PS 3.0 PS 4.0 PS 5.0 PS 5.1
Windows 10/Windows Server 2016 - - - インストール済み
Windows 8.1/Windows Server 2012 R2 - インストール済み WMF 5.0 WMF 5.1
Windows 8/Windows Server 2012 インストール済み WMF 4.0 WMF 5.0 WMF 5.1
Windows 7 SP1/Windows Server 2008 R2 SP1 WMF 3.0 WMF 4.0 WMF 5.0 WMF 5.1

私の環境はWindows 7 SP1です。バージョン5.1をインストールしてみます。
ダウンロードサイトを開きます。
Download Windows Management Framework 5.1 from Official Microsoft Download Center
ダウンロードを開始する前に、バージョン5.1の要件を確認しておきます。

Supported Operating System
Windows 7 Service Pack 1, Windows 8.1, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2

Windows Server 2012 R2
Windows Server 2012
Windows Server 2008 R2 SP1
Windows 8.1
Windows 7 SP1

**IMPORTANT**
Please see release notes for the list of products that are compatible and incompatible with Windows Management Framework 5.1.
WMF 5.1 requires Microsoft .NET Framework 4.5 or above. You can install Microsoft .NET Framework 4.5 or above by following the instructions at Installing the .NET Framework.

Microsoft .NET Frameworkのバージョンは、[コントロール パネル] の [アプリケーションの追加と削除]から確認できます。
f:id:zakiyamatakashi:20180419112246p:plain
バージョンは大丈夫そうです。

それでは、"Download"ボタンをクリックします。
f:id:zakiyamatakashi:20180419111411p:plain

なにやら、ファイルの一覧が表示されます。。。何の説明も記載されていませんが、ファイル名から察しろということでしょう。
ということで、"Win7AndW2K8R2-KB3191566-x64.zip"を選択します。選択するとNextボタンが表示され、クリックするとダウンロードが開始されます。
f:id:zakiyamatakashi:20180419113251p:plain

ダウンロードが完了したら、zipファイルを解凍します。
f:id:zakiyamatakashi:20180419113725p:plain

PowerShellを起動して、解答後のフォルダに移動し、"Install-WMF5.1.ps1”を実行します。
f:id:zakiyamatakashi:20180420145718p:plain

しばらくすると、準備完了のお知らせが表示されるので、"Yes"をクリックします。
f:id:zakiyamatakashi:20180420150037p:plain

さらにライセンスの同意が求められるので、"Accept"をクリックします。
f:id:zakiyamatakashi:20180420150340p:plain

インストールが開始され、、、
f:id:zakiyamatakashi:20180420153355p:plain

しばらくすると完了です。再起動が要求されるので、作業上問題がなければ"Restart now"をクリックします。
f:id:zakiyamatakashi:20180420153436p:plain

再起動後、PowerShellバージョンを確認すると、5.1になっています。バージョンアップに成功したようです。
PowerShellのバージョンの確認手順はこちらから。
Windows PowerShellのバージョンを確認する - Why it doesn't work?

Name Value
PSVersion 5.1.14409.1005
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1005
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

今日はここまで。