Powershell v3 & v2 Compatibilty

Question -

I am creating scipts in PS version 3 but will be executing them in PS version 2. Is this a problem? Will the scripts fail to execute?

I am in a QA environment. The current server configuration cannot be altered, that means that I can’t get v3 installed along with the necessary modules needed, so I have to create the scripts outside the QA environment and test them as best as I can.


If you just use the cmdlets and features that are available in v2 you’ll be OK but if you use any v3 features e.g. the CIM cmdlets you script will fail.

Check the release notes for v3 to see what was introduced and what you need to avoid

You can start a PowerShell 2.0 session on your development machine by running PowerShell.exe -Version 2.0 . I test scripts this way whenever I’m targeting PowerShell 2.0; no matter how careful I think I’ve been, I always manage to have a couple of 2.0-specific errors that sneak through and need to be fixed before release.

Very cool. Is it possible to run Version 2.0 ISE?

Not that I know of, though I never really tried very hard to do that. I hated the v2.0 ISE :slight_smile: