This is an ancient blog post (2007), but it still applies; Shortly speaking:
As long as new versions of PowerShell remain backward compatible, they replace earlier versions :
The installation location displayed in $PSHOME - $env:systemroot\System32\WindowsPowerShell\v1.0 , will remain the same.
The file name extension - .ps1 - will remain the same.
Scripts created for an earlier version will continue to work.
To mark the script as the required version of <n> at least, use #requires -version <n> at the top of the script (technically it can be placed anywhere in the script, but it makes sense to put it on top).
At the time of this writing (PowerShell v5.1) with v1, backward compatibility was supported, so the installation location and file name extension remained the same.
To get the current session of a PowerShell version :
> [string] $PSVersionTable.PSVersion 5.1.14393.693
In general, the hashtable $PSVersionTable introduced in v2 contains several parts of the version information (not fully) described in Get-Help about_Automatic_Variables :
Name Value ---- ----- PSVersion 5.1.14393.693
source share