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?
In File Explorer (or Windows Explorer), right-click the script file name and then select "Run with PowerShell". The "Run with PowerShell" feature starts a PowerShell session that has an execution policy of Bypass, runs the script, and closes the session.
You need to write the keyword “powershell” with a “-file” parameter followed by the path of the script to run the PowerShell script from CMD.
To run a script, open a PowerShell window, type the script's name (with or without the . ps1 extension) followed by the script's parameters (if any), and press Enter.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With