PowerShellのバージョンアップ(アップグレード)の手順になります。
まずはPowerShellを起動しバージョンを確認します。
「$PSVersionTable」と打てばバージョン情報が表示されます。
PS C:\Users\nekonoprotocol> $PSVersionTable Name Value ---- ----- CLRVersion 2.0.50727.8762 BuildVersion 6.1.7601.17514 PSVersion 2.0 WSManStackVersion 2.0 PSCompatibleVersions {1.0, 2.0} SerializationVersion 1.1.0.1 PSRemotingProtocolVersion 2.1
バージョンは2.0です。
PowerShellのバージョンアップはWindowsの更新プログラムを当てて行います。
更新プログラムは下記のURLからダウンロードしてできます。
https://www.microsoft.com/en-us/download/details.aspx?id=54616
ダウンロードを選択します。
使用しているOSに合わせて更新パッケージをダウンロードします。
ダウンロードしてきたmsuを実行するとWindowsアップデートが開始されます。
終了後に確認すると現在の最新バージョン(2018年9月時点は5.1)に上がります。
PS C:\Users\nekonoprotocol> $PSVersionTable 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
普段、PowerShellはあまり使用しないのですがVagrant利用時にPowerShell3以上が必要になったためバージョンアップをしました。
エラーは下記のように出ていました。
$ vagrant up The version of powershell currently installed on this host is less than the required minimum version. Please upgrade the installed version of powershell to the minimum required version and run the command again. Installed version: 2 Minimum required version: 3
ちなみに、古いVagrantでは発生しなかったのでVagrantのバージョンが新しくなると共にPowerShellの必要バージョンも新しくなるようです。