Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Problems Using Code from Newer PowerShell Versions in Version 2

$
0
0

I use the PowerShell ISE, running version 4, on my workstation, and I write scripts there.  I often copy the code back and forth to OneNote, using this script to copy it with formatting.  This works fine, and the code can be used with version 3 with no issues.  A lot of times, when I try to copy the code into the version 2 ISE or just run saved scripts in PowerShell version 2, I get errors stating that some perfectly valid command is not valid.  If I retype the same exact code in the version 2 ISE, the code runs without issue.  Most of my scripts either use Exchange 2010 cmdlets or the Quest ActiveRoles Management Shell for Active Directory cmdlets, but cmdlets that come with PowerShell itself are affected.

I'm wondering if anyone can shed some light on what might be happening here, and if there is a workaround where I could "fix" this code without retyping it.  I have no particular urgent need for a specific script to be fixed.  It's more that I would like to understand this better.


James


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>