Powershell provides different features according to its version. Here knowing the version of the Powershell become a necessity. There are different methods to get version of Powershell from easy to hard.
Using PSVersionTable Environment Variable
Simplest and reliable solution is using environment variable. PSVersionTable variable provides PSVersion key for the version.
As we can see in the example the major version is 2 and minor version is 0. There are also more information like
Build which shows the build number which is detailed minor number. There is also information like
Revision which is the most little number used for versioning. As we can see both
Revision numbers are shown as
-1 which means there is no specific information about these numbers.
Simply we can call this Powershell version as