tags:

views:

206

answers:

2

What sort of problems (if any) will I run into with the existing scripts once I make the jump to PowerShell2?

I'm need to automate some tasks on a Windows XP production box, and PowerShell fits the bill. However, I can't install version 2 until it becomes official so my only choice at the moment is to install version 1 and write PS1 script.

Edit: Looking for real-world, common scenarios of sorts of problems I'll run into.

+2  A: 

YES*

unless for some rare reason one of your v1 scripts happens to use a commandlet that has the same name as one included with v2:

Windows PowerShell 2.0 is backward compatible with Windows PowerShell 1.0. All the scripts written for V1 should work in V2.

In Windows PowerShell 1.0, a runtime error was generated when two Windows PowerShell snap-ins exported cmdlets with the same name.

In Windows PowerShell 2.0, the last cmdlet that is added to the session runs when you type the command name.

Source: PowerShell V2 - backward compatibility (Windows PowerShell Blog) ...

(via google)

But apparently there are work-arounds in place:

Especially for enterprise environments, it is important to understand whether an updated technology now means an incompatible technology. In the case of PowerShell v2, any scripts that you designed in v1 are completely interoperable. It is also important to note that if you design scripts in v2 that make use of cmdlets only available in that version, special syntax is available to check the version of PowerShell being used before the execution of the script. Nice!

Source: PowerShell 2.0 Coming Soon – What’s New? (compellent.com) ...

(via google)

*disclaimer: I don't know anything about powershell, except that it might be like perl-for-windows. But the source I've cited seems to be "the source". So i'd image it's pretty accurate.

Ape-inago
Actually, http://blogs.msdn.com/powershell/archive/2009/05/06/powershell-v2-backward-compatibility.aspx contradicts this (and it's not the MS way to break compatibility) with some caveats. However, I would like some real-world answers. That is, outside of the PowerShell team.
hythlodayr
Um, thats the same link I sourced you?
Ape-inago
Ah, I'd clicked on the google part and thought that's all there was to it.
hythlodayr
Yeah, I just realized that there are no underlines, so the two links look like one. Fixed it :D
Ape-inago
WHOOPS, lol, i meant "YES*"sorry about that, it's been a long day.
Ape-inago
A: 

Nevermind. :-)

Keith Hill