Newer PowerShell versions obviously will come with new features and new cmdlets. This is something which is important to take into consideration when writing scripts, or PowerShell walkthroughs, which may be run locally across systems with different versions installed.
A simple example would be
Get-FileHash. This command is new to PowerShell 4.0, and will not be available to any system running an earlier version. It will especially not be available to any systems running Windows 7 SP0 (or Server 2008 R2 SP0) or lower, since PowerShell 4.0 is not supported on those systems at all.
However, aside from a simple matter of supporting the given PowerShell version, even further consideration needs to be made for which Operating System version is installed. For example,
Test-NetConnection is only (currently) available to Windows 8.1 (or Server 2012 R2) regardless of which version of PowerShell is installed on a system running any earlier Operating System.
This is all pretty straightforward for scripts or guides that will run PowerShell commands on the local system – if the local system has Operating System version A and PowerShell version B, you can use (and can only use) any commands supported on OS A with PS B. However, it doesn't seem quite so straightforward or clear for cases where a script addresses a remote computer which may be running a different Operation System or PowerShell version.
So, how do differing PowerShell versions affect commands run against remote computers?
- If the local system is running a higher version, will the newer commands/features be available to use against the remote system?
- If the remote system is running a higher version, is there an easy (and scriptable) way to leverage the newer commands/features against it when the local system doesn't support them?
- Are there general rules one can bear in mind to know what compatibility issues to expect, or is this something that varies widely and needs to be individually researched/tested for each command or feature used?