Portable PowerShell - v1 and v2 side by side - even on Server Core.
June 17th, 2008 by KarlSo I’ve loved portable apps from time memorial and have valued making my own apps as portable as possible - XCOPY friendly. I’ve valued this over some fancy installer. But what about PowerShell? Why can’t PowerShell be portable. Its the sort of tool that begs to be portable. Admins want a power tool, like powershell to be portable, to be able to be run on any computer without installing anything (changing ,even contaminating the state of the computer). Admins don’t want to have to worry about installing prerequisites such as dotnet 2.0 everywhere and neither do I. I want something that can be self contained , where I can run PowerShell v1 and v2 side by side if I choose, and as a builder of PowerShell hosts, I want to be able to embed, or distribute the PowerShell runtime along with my app, just like I can with a multitude of dotnet libraries and components.
Well is this possible. Yes, I’ve done it. In this blog post I’ll show some screenshots and a video about it, and talk about the WHAT and the WHY, and try to whelm up some passion in the community to encourage Microsoft to allow the PowerShell engine to be redistributed freely, easily , and portably. I know that many people will ask me - Can I download this, and I have to say NO - because we don’t have rights from MS to redistribute PowerShell, especially outside of its official packages, but the good news is that you can make this yourself, but I’m not going to tell you HOW to until tomorrow, hoping that instead of running of to recreate your own personal PowerShell nirvana you might read the rest of my rant and join the movement for a Microsoft endorsed Portable PowerShell.
But before we proceed here is a screenshot:
This beauty shows Server Core Enterprise - you can verify this isn’t a trick but is indeed server core by the operatingsystemSKU of 14 shown in the top window. (MSDN reference. ) Server Core does not have dotnet 2.0 (a prerequisite of PowerShell) installed and we haven’t applied any cool hacks or Russian reverse engineering to get it working therefore we haven’t compromised the secure state of our servercore by installing any untested potential lasting security hole on it. We purely XCOPY across our files, or we can even run it off a USB drive. Another great benefit you see here is on the same machine we are running PowerShell V1 and V2 side by side. How many of us have had to set up a whole new machine or VM just to play with V2 CTP!!!!! and how many cough*cough have installed v2 on a production machine when we should have for lack of patience in setting up a dedicated v2 test machine?
So what are the features of this technique.
- Fully Portable
- versions that presume dotnet 2.0s preexistence (about 3MB to 10MB)
- Versions that don’t need dotnet 2.0 at all (about 100MB)
- Can run V1 and V2 side by side.
- Can run on a machine with PowerShell already installed, and your portable version has its own execution-policy and other settings.
- Can be packaged with SnapIns (so the SnapIns are portable also, no need to install or register them).
- Can be used with a custom Host , so you can have a Portable PowerShell Plus or PowerShell Analyzer.
Here is a 3 minute video showing Portable Powershell v1 and v2 and PowerShell Analyzer running side by side on a virgin XP SP2 box that doesn’t have dotnet 2.0 preinstalled.
So now you are saying, GIVE THIS TO ME NOW. Sorry but I can’t but in my next blog entry within a couple of days I will tell you how you can roll your own Portable PowerShell.
Please leave a comment on this blog if you are in favor of Microsoft relaxing its redistributable rules when it comes to PowerShell. Technically PowerShell doesn’t have much to stop it being Portable. Its fully dotnet, and although its installed in windows\system32 directory that is more a "political" feature , earlier betas would install elsewhere, and technically it wouldn’t be hard to make it a control in VS.NET that a custom host could merge into their project and be fully portable. There are many many possible use-cases for such portable uses (both from the perspective of admins as well as developers creating PowerShell enabled and powered applications in the growing PowerShell ecosystem). If MS can’t make any changes technically to make it as easy as i suggest in V2, can they at least GIVE FULL REDISTRIBUTABLE RIGHTS FOR POWERSHELL as they do things such as the SQL server client side report viewer control in VS.NET.
All in favor say so in a comment!
And come back for more in a day or two.
Over and Out,
Karl Prosser / ShellTools.
Posted in Powershell |

Entire RSS
June 18th, 2008 at 1:07 am
[…] Portable PowerShell - v1 and v2 side by side - even on Server Core. - Karl Prosser taks about making PowerShell into a portable application (the kind that will run off a USB stick with no install), and explains that it is possible, however it can’t be distributed due to the licensing. I have a suspicion about how he’s achieving this, and am looking forward to the next part of this article where the actual process is revealed. […]
June 18th, 2008 at 3:09 am
Karl, brilliant!
This would be fantastic for my job as I often work at different sites; having a full featured, known environment on a USB device would be perfect.
Please add my vote+++ to the move to get this supported by Microsoft.
Best regards,
Chris Warwick
June 18th, 2008 at 5:22 am
This is totaly awesome, Thank you! Microsoft should make this a part of the sysadmin philosophy.
—
Shay Levy
$cript Fanatic
http://scriptolog.blogspot.com
June 18th, 2008 at 5:52 am
Karl,
you da man !
June 18th, 2008 at 7:41 am
You tease.
-hal
Co-Host, PowerScripting Podcast
(http://powerscripting.net)
June 18th, 2008 at 9:04 am
This is !!
grand, swell, grandiose, great, excellent, tremendous, extraordinary, marvellous, splendid, fabulous, terrific, prodigious, fantastic, phenomenal, smashing, top-notch, first-rate, powerful, mighty, formidable, immense, enormous
June 18th, 2008 at 9:55 am
very impressive, cant wait for the second part
June 18th, 2008 at 10:39 am
Karl, this is brilliant. Hope Microsoft endorses this use scenario and then I can have my PowerShell toolkit running from Live Mesh!
Looking forward to the how-to!
Jonathan
June 18th, 2008 at 11:40 am
Please add my vote. Having a portable PowerShell would fit sooo well into my firm’s plans for our future desktop upgrade. In a perfect world, I don’t want anything “installed” except for the OS! (A guy can dream, can’t he?)
June 18th, 2008 at 12:21 pm
Sounds *very* cool. I’m looking forward to your instructions; would love to be able to use this technique.
+1 for redistributable.
June 18th, 2008 at 1:25 pm
Bring it! No, seriously, please make PS portable!
June 18th, 2008 at 1:27 pm
I agree, I’d love a portable powershell. The less “installed” applications, the better.
June 18th, 2008 at 1:53 pm
Karl, Great Job!
You got my vote!
June 18th, 2008 at 3:24 pm
Another vote here. Outstanding work Karl.
June 18th, 2008 at 4:01 pm
Karl,
Count this as my support for asking Microsoft to relaxing the redistribution rights for PowerShell.
Fantastic work! Keep innovating!
June 18th, 2008 at 5:01 pm
Leapin Lizards!!
A portable Powershell environment on my USB drive? Are you kidding me?
pleasepleasepleasepleasepleasepleasepleasepleaseplease
pleasepleasepleasepleasepleasepleasepleasepleaseplease
pleasepleasepleasepleasepleasepleasepleasepleaseplease
pleasepleasepleasepleasepleasepleasepleasepleaseplease
pleasepleasepleasepleasepleasepleasepleasepleaseplease
pleasepleasepleasepleasepleasepleasepleasepleaseplease
tell me it’s do-able and it’s not going to wreck the first server I try it on?
OK gotta go wipe the drool off the keyboard now.
Stuart
PS - please.
June 18th, 2008 at 9:11 pm
Put my vote in right now! I _want_ this!
June 19th, 2008 at 3:15 am
[…] Full Article […]
June 19th, 2008 at 6:15 am
I haven’t used Powershell in many customer environments just yet, because of the need to install the .Net framework and powershell. That’s the reason we still use allot of VBscript based scripts, because it runs on every Windows based system without having to install anything.
This portable version of Powershell would be great!! I would then be able to use the power of Powershell, without going to the customer and ask them for permissions to install the .Net Framework and powershell.
So, please Microsoft, listen to your customers and allow this wonderful initiative.
June 19th, 2008 at 12:57 pm
You got my vote. Powershell on a USB drive would be awesome. Can’t wait for the next post.
June 19th, 2008 at 3:15 pm
To be able to bring a portable, pre-configured PowerShell environment to servers that don’t have PowerShell loaded would just be freaking awesome.
It would also win over some of my vbScript friends who won’t/can’t find the time to switch now because PowerShell isn’t on our servers so there is not much incentive to learn it yet.
June 19th, 2008 at 3:34 pm
This is plainly a beautiful thing of great utility. Microsoft, set it free.
June 22nd, 2008 at 8:27 am
Of course I want this. I want it now and I want it on Server Core and on Server and on Workstation and I want it on Visgt and XP and Windows 7.
Please???
June 22nd, 2008 at 2:48 pm
Almost sounds like thinstalled package
I wanted to play with combination of Server Core and ThinStall (or project NorhtStar as it is called now), however never found enough time 
June 22nd, 2008 at 4:29 pm
Wow! Good work Karl. You got my vote…
June 23rd, 2008 at 12:07 am
Hey Karl !
It’s absolutely awesome !!! Nice work.
I’m looking forward to seeing the next part of your blog post.
Arnaud
June 23rd, 2008 at 8:29 pm
+1
This is quite forward thinking. Thank you for spending the time on this.
Microsoft, please consider this.
June 23rd, 2008 at 11:00 pm
[…] Portable PowerShell? Karl Prosser has a way to do it. […]
June 25th, 2008 at 5:45 pm
Great idea!! MS please respond with aproval for Karls request. My biggest challenge to using PS is not being able to install on servers. This would give me the ability to bypass that problem. Can’t wait to see how its done.
June 26th, 2008 at 6:38 am
[…] Get all the details on Karl Prosser [MVP] blog. Posted: Jun 18 2008, 01:22 PM by ScriptFanatic | with no […]
June 26th, 2008 at 9:05 am
[…] http://karlprosser.com/coder/2008/06/17/portable-powershell-v1-and-v2-side-by-side-even-on-server-co… Filed under: _ English / Anglais, _ Francais / French, PowerShell […]