Powershell v3 & v2 Compatibilty

This topic contains 4 replies, has 4 voices, and was last updated by Profile photo of Dave Wyatt Dave Wyatt 3 years ago.

  • Author
    Posts
  • #16319
    Profile photo of Powershell User
    Powershell User
    Participant

    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.

  • #16320
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    Possibly.

    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

  • #16321
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    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.

  • #16342
    Profile photo of Nobody
    Nobody
    Participant

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

  • #16343
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

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

You must be logged in to reply to this topic.