Powershell v3 & v2 Compatibilty

Welcome Forums General PowerShell Q&A Powershell v3 & v2 Compatibilty

This topic contains 4 replies, has 4 voices, and was last updated by

 
Member
4 years, 4 months ago.

  • Author
    Posts
  • #16319

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    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

    Member
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

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

  • #16343

    Member
    Points: 0
    Rank: Member

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

The topic ‘Powershell v3 & v2 Compatibilty’ is closed to new replies.