DCSIMG
Running PowerShell 1.0 and 2.0 on the same machine - Shay Levy

Shay Levy

If you repeat it, PowerShell it!

Running PowerShell 1.0 and 2.0 on the same machine

Windows XP Mode (XPM) for Windows 7 makes it easy to install and run many of your Windows XP productivity applications directly from a Windows 7 based PC. It utilizes virtualization technology such as Windows Virtual PC to provide a Virtual Windows XP environment for Windows 7. Windows XP Mode provides a 32-bit Windows XP Professional Service Pack 3 (SP3) environment pre-loaded on a virtual hard disk.

In this post I’ll demonstrate how to install, publish and launch PowerShell 1.0 side by side with PowerShell 2.0 which is already a part of Windows 7. First, you need to download Windows Virtual PC Beta and Windows XP Mode. Lets’ start.

Install Windows6.1-KB958559-x64.msu and reboot if asked to. Next run VirtualWindowsXP.msi

 

It is recommended to save the password you choose. That way you won’t have to enter the user credentials each time you launch XPM.

At this point XPM is loading and initializing its components

 

XPM performs auto logon (if you choose to save the user credentials). When you open My Computer you’ll see your Windows 7 local drives as mapped drives. That way you can copy/run files from Windows 7 into XPM. You cannot drag & drop files into XPM, maybe future releases will have that feature. Make a folder on one of your Windows 7 local drives and put there a copy of .NET 2.0 and Windows PowerShell 1.0. Install .NET and then install PowerShell 1.0.

Now for a little gotcha. Someone at Microsoft decided to block PowerShell and PowerShell ISE (and a bunch of other applications), XPM won’t publish their shortcuts to Windows 7 start menu. You’ll need to delete the ‘PowerShell’ values so XPM can publish their shortcuts.

I want to thank MVP Charlie Russel for sharing this tip with me!

 

Launch PowerShell 1.0 and create a profile. I had some issues when I tried to launch PowerShell 1.0 with no profile, for some reason it ran my Windows 7 profile.

EDIT: You can force XPM PowerShell to load your v1 profile if you disable the “Drives” sharing in ‘Integration Features’ (Tools | Settings…)

ics

 

Now close the VM by pressing the X button (you may need to reboot the VM, press CTRL+ALT+DEL at the top menu and then press the Shutdown button).

Take a look at Windows 7 start menu, XPM will (hopefully) publish PowerShell shortcuts :-), you should see something like the following:

As you can see all of PowerShell’s shortcuts were published except for PowerShell itself. In this case launch XPM again and copy the PowerShell shortcut under ALLUSERS profile.

Close the VM (you may have to reboot it again) and check if the shortcut was published.

OK, now click the ‘Windows PowerShell (Virtual Windows XP 1)’ shortcut, you’ll probably get this dialog:

Click ‘Open Virtual Application’, this will launch PowerShell 1.0 in seamless mode, here’s a screenshot of my desktop showing both versions of PowerShell running on the same machine:

Isn’t that great!

Comments

Alan Renouf said:

Thats great, a nice way of doing it, thanks for blogging this.

Alan

# May 12, 2009 7:41 PM

Film in the Eighties » Blog Archive » Quick scan of the net - machine folder said:

Pingback from  Film in the Eighties  » Blog Archive   » Quick scan of the net - machine folder

# May 12, 2009 8:31 PM

tsahi said:

One is left to wonder, why would you want PowerShell 1.0 when you have PowerShell 2.0?

# May 13, 2009 12:18 AM

ScriptFanatic said:

Hi Tsahi, several Reasons:

1. It's good to have access to both :)

2. v1 is the official release, v2 is still in development.

3. When you need to test scripts on v1 (though v2 is compatiable with v1, blogs.msdn.com/.../powershell-v2-backward-compatibility.aspx), especially if you are an active guy in PowerShell community (answering questions on forums etc)

4. Some 3rd tools are not V2 approved.

# May 13, 2009 11:54 AM

Episode 71 – Doug Hazelman from Veeam « PowerScripting Podcast said:

Pingback from  Episode 71 – Doug Hazelman from Veeam «  PowerScripting Podcast

# June 3, 2009 5:21 AM

Jean Louw said:

Thanks Shay, this is brilliant!

# June 25, 2009 11:52 AM

ls said:

Do you know why Powershell 2.0 still installs into C:\Windows\System32\WindowsPowerShell\v1.0?

Why the v1.0 folder and not v2.0?

# August 28, 2009 2:37 AM

ScriptFanatic said:

In my opinion the reason is to maintain backwards compatibility. In the below blog post (last bullet) Jeffrey Snover explains why they have decided to keep using ps1 script extensions instead of ps2 in v2, so I guess we can assume the same for the folder name.

blogs.msdn.com/.../ctp-versioning.aspx

# August 30, 2009 6:07 PM

Get Going on Powershell | Becoming a SQL Master said:

Pingback from  Get Going on Powershell | Becoming a SQL Master

# November 29, 2010 11:10 PM

Get Going on Powershell | SQLServerPedia said:

Pingback from  Get Going on Powershell | SQLServerPedia

# November 30, 2010 11:06 AM

aStore Script v1.0 Professional Edition | 7Wins.eu said:

Pingback from  aStore Script v1.0 Professional Edition | 7Wins.eu

# October 17, 2011 12:45 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: