tags:

views:

2014

answers:

3

Is there a way to bundle PowerShell such that I don't have to install it on the OS? Ideally I'd like to use it in my build process, but I want something that's self-contained; I don't want to rely on each client computer installing PowerShell. I'm thinking I'd build a console app that hosts a PowerShell environment, but bundles the PowerShell assemblies locally.

Assuming it's possible, are there any royalty/licensing issues with such a setup?

+3  A: 

You can host a powershell runtime inside a .net application using the System.Management.Automation dll, but I believe to run this you still need to have access to the powershell runtime on the machine. Unless there is a way to contain the whole runtime inside the applicaiton, which form my research does not seem possible, you will need to install powershell on each machine. If its any consolation, at the minute windows 7 comes with powershell installed by default.

Sam Cogan
I'm holding off for a while hoping someone else answers with "YES IT'S POSSIBLE! HERE'S HOW!" Otherwise you get the checkmark.
Peter Seale
System.Management.Automation.dll IS the PowerShell runtime. PowerShell.exe is just a console interface to that. Hosting the PowerShell runtime in something else was one of the main design goals as stated by the PowerShell team.
JasonMArcher
+3  A: 

I'm not sure how much time I'll have to be able to see if the libraries can be somewhat independently copied. You are expecting the .NET Framework 2.0 to be on the machine?

There is some information here: http://karlprosser.com/coder/2008/06/19/portable-powershell-part-2-roll-your-own-plus-a-challenge/

But this isn't officially supported by Microsoft. Microsoft's stance will likely be that you must install PowerShell with the msi/msu or add the feature.

Marco Shaw
Thanks for the link, "Portable PowerShell" is exactly what I'm looking for, AND I'm looking to redistribute it, broadly. So, after reading his post, it looks like a) none of the app virtualization tools are free, and b) I wouldn't likely be able to redistribute PowerShell anyway for legal reasons.
Peter Seale
Oh, I let me also mention this company/product: http://www.specopssoft.com/powershell/Something to read up about, especially if you do decide to distribute PowerShell everywheres and don't have a solution like System Center Configuration Manager or SMS.
Marco Shaw
+1  A: 

Depends on what you want to do. For simple file copying etc Im using the Get-WmiObject and Invoking commands on the remote machine.

This means that I can run stuff on an XP sP2 machine.

Tom Newman