Michael
Michael

Reputation: 299

Finding out required Powershell Version

I wrote a PS-Script for a colleague and it did not work the first time on his machine (after installing PS 4 it is working).

As we are not globally rolling out the most recent PS Version, and my next Script would affect several people, I want to write it in a Low-Version-Compatible format.

Is there a way to check (or an IDE) which determines the needed version for a command or the whole script?

Thanks in advance :)

Upvotes: 1

Views: 129

Answers (1)

ojk
ojk

Reputation: 2542

I don't think so, but you can use the #Requires tag to inform PowerShell of the required lowest version the script needs to be able to run. You can read more about it here: http://technet.microsoft.com/en-us/library/hh847765.aspx

You can also start PowerShell with the -Version parameter to "simulate" a lower version if you want to check if it works on a specific PowerShell version.

Upvotes: 3

Related Questions