Blogroll

Search

Portable PowerShell – v1 and v2 side by side – even on Server Core.

June 17th, 2008 by Karl

UPDATE FEB 2010We don’t need to rely on things like thinapp or app-v anymore. At ShellTools we have build our own Portable PowerShell framework. Its currently in Beta – see http://www.portablepowershell.com for more details.


So 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:

servercore2

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.

Portable PowerShell from karl prosser on Vimeo.

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.

Technorati Tags: ,,,,

Posted in Powershell, pscom | 48 Comments »

48 Responses

  1. Reflective Perspective - Chris Alcock » The Morning Brew #117 Says:

    [...] 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. [...]

  2. Chris Warwick Says:

    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

  3. Shay Says:

    This is totaly awesome, Thank you! Microsoft should make this a part of the sysadmin philosophy.


    Shay Levy
    $cript Fanatic
    http://scriptolog.blogspot.com

  4. Jacob Saaby Nielsen Says:

    Karl,

    you da man !

  5. Hal Rottenberg Says:

    You tease.

    -hal
    Co-Host, PowerScripting Podcast
    (http://powerscripting.net)

  6. Robertico Says:

    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

  7. Libor Says:

    very impressive, cant wait for the second part :)

  8. Jonathan Noble Says:

    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

  9. Kevin Buchan Says:

    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?)

  10. Gregory Smith Says:

    Sounds *very* cool. I’m looking forward to your instructions; would love to be able to use this technique.

    +1 for redistributable.

  11. David Says:

    Bring it! No, seriously, please make PS portable!

  12. Reed Wiedower Says:

    I agree, I’d love a portable powershell. The less “installed” applications, the better.

  13. Ying Li Says:

    Karl, Great Job!

    You got my vote!

  14. Shane Powser Says:

    Another vote here. Outstanding work Karl.

  15. Steven Murawski Says:

    Karl,

    Count this as my support for asking Microsoft to relaxing the redistribution rights for PowerShell.

    Fantastic work! Keep innovating!

  16. Stuart Henderson Says:

    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.

  17. Carl Clark Says:

    Put my vote in right now! I _want_ this!

  18. Running portable PowerShell V1 and V2 side by side on Server Core » D' Technology Weblog: Technology, Blogging, Tips, Tricks, Computer, Hardware, Software, Tutorials, Internet, Web, Gadgets, Fashion, LifeStyle, Entertainment, News and more by Deepak Says:

    [...] Full Article [...]

  19. Richard Waal Says:

    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.

  20. Greg Bray Says:

    You got my vote. Powershell on a USB drive would be awesome. Can’t wait for the next post.

  21. sepeck Says:

    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.

  22. bocarp Says:

    This is plainly a beautiful thing of great utility. Microsoft, set it free.

  23. Thomas Lee Says:

    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???

  24. Martin Says:

    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 :(

  25. Shark Says:

    Wow! Good work Karl. You got my vote…

  26. Arnaud Petitjean Says:

    Hey Karl !

    It’s absolutely awesome !!! Nice work.
    I’m looking forward to seeing the next part of your blog post.

    Arnaud

  27. EDF Says:

    +1

    This is quite forward thinking. Thank you for spending the time on this.

    Microsoft, please consider this.

  28. Episode 30 – TechEd Report « PowerScripting Podcast Says:

    [...] Portable PowerShell? Karl Prosser has a way to do it. [...]

  29. steven Says:

    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.

  30. Portable PowerShell - Shay Levi Says:

    [...] Get all the details on Karl Prosser [MVP] blog. Posted: Jun 18 2008, 01:22 PM by ScriptFanatic | with no [...]

  31. Office et SharePoint pour et par les administrateurs : PowserShell portable ? Says:

    [...] 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 [...]

  32. Per Østergaard Says:

    Yes, I definately want a portable version. I’m using lots of other portable tools – and with a portable tool, you can use it without having to think about change management procedures etc.

  33. benny keshet Says:

    Hi Karl,
    Great idea

  34. Lo0m Says:

    WOW!! Powershell on USB would be wonderful. I could effeciently fix my friends’ computers without having to install ANYTHING! I thought this is sci-fi :-)

  35. Julie Smith Says:

    Portable Powershell would be magnificent.

    Make it so, Microsoft!

  36. Andy S Says:

    Totally cool! Another yes vote!

  37. Durchbruch für die PowerShell « Peter’s PowerShell Blog (German only) Says:

    [...] CTP bereits sehr gut arbeiten kann. Besonders Wagemutige können ein Rezept von PowerShell-Guru Karl Prosser ausprobieren, in dem dieser beschreibt wie sich V1 und V2 parallel einsetzen [...]

  38. Portable PowerShell | keyongtech Says:

    [...] Portable PowerShell to anybody interested, I blogged about using PowerShell in a portable manner. http://karlprosser.com/coder/2008/06…n-server-core/ [...]

  39. Peter Seale Says:

    Two real-world scenarios requiring a redistributable PowerShell:

    * build scripts – I want to use PowerShell as my build script. Unfortunately, as it stands PowerShell cannot be included in a “/tools/” subdirectory because it’s not redistributable.

    * user login scripts – There is no reason why we can’t use PowerShell to power our user login scripts–except the fact that it’s tough to install PowerShell on thousands of desktops. A redistributable PowerShell would solve this problem.

  40. Peter Seale Says:

    I should clarify: the #1 thing that separates PowerShell’s psake build tool from rake (Ruby) or bake (Boo) is that PowerShell cannot be included in a /tools/ subdirectory. Believe it or not, this is enough to tip people away from using psake.

  41. Stijn Peeters Says:

    Please this possible!

    I too cannot install anything on client pc’s.

    This would be great to show demo’s of our products

  42. .NET-Versionitis auch bei der PowerShell « Peter’s PowerShell Blog (German only) Says:

    [...] .NET-Anwendungen (die zudem beide auf dem .NET Framework 2.0 aufsetzen). In einem Blog-Eintrag hat Karl Prosser beschrieben, wie es doch funktionieren kann, doch wurde mir bereits beim Überfliegen der [...]

  43. Benjamin Jimmie Says:

    “Please leave a comment on this blog if you are in favor of Microsoft relaxing its redistributable rules when it comes to PowerShell”

    aye from me

  44. Steffen Says:

    You got my vote.

    lol I just got the idea to check out the internet for a portable version of powershell, cause this would be awesome.
    Now I see here is a hole community
    which cant wait for the next peace of information.

    But unfortunately the last post is old and this topic doesn’t seam to be hot discussed anymore.

  45. Karl Says:

    Everybody who is following this. We now have a beta on our Portable Powershell. http://www.portablepowershell.com

  46. Damian Powell Says:

    Awesome. I definitely vote for redistro rights for PowerShell.

    I’d like to use PowerShell for scripting and configuration within my application but that’s only feasible if we can include the install as a dependency in our own installer.

  47. somebody Says:

    put my vote in, pleas!

  48. m0riss Says:

    Any way of adding modules and snap-ins not included in this distribution (Citrix for example) ?

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.