1

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 :)

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Exactly what I searched, perfect!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.