$PSVersionTable.PSVersion
Returns the current version of PowerShell running.
PS C:\> $PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 5 1 14393 0
$PSVersionTable.PSVersion
DetailsPS C:\> $PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 5 1 14393 0