Windows PowerShell has been out for a few versions now. The following Windows versions had different versions of PowerShell.
- Windows Server 2008 – PowerShell 1.0 (optional component)
- Windows 7/Windows Server 2008 R2 – PowerShell 2.0
- Windows 8/Windows Server 2012 – PowerShell 3.0
- Windows8.1/Windows Server 2012 R2 – PowerShell 4.0
Also, PowerShell could be downloaded separately and installed in some downlevel versions of Windows.
An easy way to find out what version of PowerShell you are using is to use the Get-Host cmdlet.
Additionally, you can utilize the $PSVersionTable variable.
If you’re using this as a determining factor in an application, you can use the pre-populated $host variable, and then dot your way to see the major/minor version, like: