I am starting to run more and more PS scripts and often run into some servers running outdated versions of PS that need to be updated before the scripts will run. I'd like to add a PS version check at the top of every script (I only have a few actually) that checks the installed version and then compares that against the minimum version required. If the installed version is too old then it prompts the user with the versions and information indicating the issue. If the installed version is newer then it continues with the script.
Open in new windowIf the running version isn't equal to or above the stated version you get an error like below.
Open in new window
Run help about_requires for more info.