Advanced Windows PowerShell Scripting Video Training

Advanced Windows PowerShell Scripting Video Training
Advanced Windows PowerShell Scripting Video Training

Monday, January 14, 2013

Running PowerShell V2 on Windows Server 2012

Microsoft has always gone way out of their way to maintain backward compatibility for as long as possible.  In 2011, while delivering a class in New York, one of my students worked at a regional airport in the area.  He said that the landing system was still running Windows NT.  Even though the current version on the market was Windows Server 2008 R2, the software on the Windows NT system was working just fine.  Why fix what is not broken?

For those who have made a significant investment in PowerShell V2, your scripts should run just fine in PowerShell V3.  In the slim chance of a problem, you can run your script using the V2 engine.  For systems that were upgraded to PowerShell V3, such as your Windows 7 workstation, the V2 engine is already present.  For fresh installs, it is not.

On Windows Server 2012, Open Server Manager.

On the Dashboard, click Add roles and features.

Click Next 4 times.

Expand Windows PowerShell and then check Windows PowerShell 2.0 Engine.

image

Click Add Features and then click Next.

Click Install and then Close

Once the installation finishes, open PowerShell.

Type $PSVersionTable and press Enter.

image

Notice the PSVersion is 3.0

Now, type PowerShell.exe –version 2.0 and press Enter.

Type $PSVersionTable and press Enter.

image

Notice you are in V2 mode. To exit V2 mode, type Exit and press Enter.

You can also start V2 mode from the Start menu by typing PowerShell.exe –Version 2.0 and pressing Enter.

No comments: