はじめに
Windowsごとのデフォルトバージョン
- Windows7
- 2.0
- Windows8
- 3.0
- Windows8.1
- 4.0
- Windows10
- 5.0
PowerShellスクリプトを初めて実行する場合

Powershellのps1ファイルを実行する方法
PowersehllをはじめるにあたりWindowsのコマンドラインインターフェースであるPowershellはコマンドレットと言われる命令をテキストファイルに記述したスクリプトファイルを実行することが出来ます。Powershellは...
Powershellの起動方法

Powershellのps1ファイルを実行する方法
PowersehllをはじめるにあたりWindowsのコマンドラインインターフェースであるPowershellはコマンドレットと言われる命令をテキストファイルに記述したスクリプトファイルを実行することが出来ます。Powershellは...
$PSVersionTableを参照する
$PSVersionTable
結果の「$PSVersionTable」の値がPowershellのバージョンです。
PowerShellのバージョンにより処理を分岐するサンプルプログラム
メジャーバージョンが5以下の場合powershell.exe5より大きい場合pwsh.exeのパス文字列を返す。
$psExePath = if ($PSVersionTable.PSVersion.Major -le 5)
{
echo "${PSHOME}`\powershell.exe"
} else {
echo "${PSHOME}`\pwsh.exe"
}
Write-Host $psExePath
Windows7にPowershell Version5.1をインストール
Download Windows Management Framework 5.1 from Official Microsoft Download Center
Windows Management Framework 5.1 includes updates to Windows PowerShell, Windows PowerShell Desired State Configuration (DSC), Windows Remote Management (WinRM)...
Win7AndW2K8R2-KB3191566-x64.zip(64bit版)
Win7-KB3191566-x86.zip(32bit版)
ダウンロードしたzipファイルを展開します。
「Install-WMF5.1.ps1」が更新スクリプトですので、実行します。
更新が完了すると再起動を要求されます。
コメント