Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ikarstein/ps2exe.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkenaro <inbox@kenaro.com>2020-11-11 15:30:26 +0300
committerkenaro <inbox@kenaro.com>2020-11-11 15:30:26 +0300
commitda879badd20c0c75f386badaca6566c44950aa95 (patch)
tree3ef57545e00ab29f0c03094e20402a6d52a4ee46
Migration from Technet Gallery (https://gallery.technet.microsoft.com/PS2EXE-Convert-PowerShell-9e4e07f1?redir=0)
-rw-r--r--MS-PL.txt22
-rw-r--r--PSEXE.icobin0 -> 1150 bytes
-rw-r--r--callPS2EXE.bat14
-rw-r--r--createDemo.bat15
-rw-r--r--ps2exe.ps1bin0 -> 104688 bytes
-rw-r--r--readme.md116
-rw-r--r--test.ps1bin0 -> 2390 bytes
7 files changed, 167 insertions, 0 deletions
diff --git a/MS-PL.txt b/MS-PL.txt
new file mode 100644
index 0000000..03f06fc
--- /dev/null
+++ b/MS-PL.txt
@@ -0,0 +1,22 @@
+Microsoft Public License (Ms-PL)
+ from http://www.microsoft.com/opensource/licenses.mspx#Ms-PL
+
+This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
+
+
+1. Definitions
+
+The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. A "contribution" is the original software, or any additions or changes to the software. A "contributor" is any person that distributes its contribution under this license. "Licensed patents" are a contributor's patent claims that read directly on its contribution.
+
+2. Grant of Rights
+
+(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
+
+3. Conditions and Limitations
+
+(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
+(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. \ No newline at end of file
diff --git a/PSEXE.ico b/PSEXE.ico
new file mode 100644
index 0000000..7539dd2
--- /dev/null
+++ b/PSEXE.ico
Binary files differ
diff --git a/callPS2EXE.bat b/callPS2EXE.bat
new file mode 100644
index 0000000..e4202c9
--- /dev/null
+++ b/callPS2EXE.bat
@@ -0,0 +1,14 @@
+@ECHO OFF
+set cmd=
+:Loop
+IF "%~1"=="" GOTO Continue
+
+set cmd=%cmd% '%1'
+
+SHIFT
+GOTO Loop
+:Continue
+
+rem echo %cmd%
+powershell.exe -command "&'.\ps2exe.ps1' %cmd%"
+
diff --git a/createDemo.bat b/createDemo.bat
new file mode 100644
index 0000000..0f2b98b
--- /dev/null
+++ b/createDemo.bat
@@ -0,0 +1,15 @@
+call "callPS2EXE.bat" "test.ps1" "test.exe" -iconFile PS2EXE.ico
+
+call "callPS2EXE.bat" "test.ps1" "test_x64.exe" -x64
+
+call "callPS2EXE.bat" "test.ps1" "test_x86.exe" -x86
+
+call "callPS2EXE.bat" "test.ps1" "test_20_STA.exe" -sta -runtime20 -iconFile PS2EXE.ico
+
+call "callPS2EXE.bat" "test.ps1" "test_30_MTA.exe" -mta -runtime30
+
+call "callPS2EXE.bat" "test.ps1" "test_30_NOCONSOLE.exe" -noconsole -runtime30
+
+call "callPS2EXE.bat" "test.ps1" "test_20_NOCONSOLE.exe" -noconsole -runtime20
+
+call "callPS2EXE.bat" "test.ps1" "test_40.exe" -runtime40
diff --git a/ps2exe.ps1 b/ps2exe.ps1
new file mode 100644
index 0000000..9c3e1be
--- /dev/null
+++ b/ps2exe.ps1
Binary files differ
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..8e917d7
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,116 @@
+This has been moved from Codeplex (http://ps2exe.codeplex.com) and was last updated 3/5/2015
+
+Now it has been migrated from https://gallery.technet.microsoft.com/PS2EXE-Convert-PowerShell-9e4e07f1?redir=0 at 11/11/2020. There are successors that are based on this project. But for "historic" reasons I migrate it to GitHub.
+
+
+# PS2EXE - v0.5
+
+Release Notes:
++ v0.5
++ v0.4
++ v0.3
+
+### Original description of version 0.1 with updates - especially in the "Usage" section
+
+In the last days I created the tool `PS2EXE`. It is able to `convert` PowerShell scripts to `standalone` EXE files.
+
+But: It does not convert the PowerShell script to an other language! It encapsulates the script with a lightweight PowerShell host written in C# and compiles the dynamically generated C# source code in memory to an EXE file. The resulting EXE is an .NET assembly that contains the source script encoded in Base64. The EXE includes all stuff that is needed to execute an PowerShell through the .NET object model. It is based on classes in the namespace System.Management.Automation that reperents the PowerShell engine. – Therefore the EXE file is not a real `standalone` EXE file. It needs PowerShell to be installed!!! And – of course – it needs .NET Framework v2.0. Furthermore `script execution` have to be allowed (see cmdlet: set-execultionpolicy). – The resulting EXE is `MSIL` and is able to execute as x64 or x86.
+
+The tool `PS2EXE` itself is a PowerShell script! – It does the in-memory compilation and generates the EXE file. It uses the CSharpCodeProvider class of namespace Microsoft.CSharp.
+
+The script is really simple. I contains a multiline string that represents the PowerShell host I’ve written. This is much more interesting than the PS2EXE.ps1 script itself. – Have a look into it!
+
+Usage:
+
+Call the script with this parameters:
+
+
+| Switch | Description |
+| --- | --- |
+| -inputFile | PowerShell script file |
+| -outputFile | file name (with path) for the destination EXE file |
+| -debug | (switch) generate debug info in the destination EXE file. The dynamically generated .CS file will stored beside the output EXE file. Furthermore a .PDB file will be generated for the EXE file |
+| -verbose | (switch) shows also verbose informations â€` if any. |
+| 0 | (switch) compile EXE to run as 32 bit application |
+| 0 | (switch) compile EXE to run as 64 bit application |
+| -runtime20 | (switch) force running the EXE in PowerShell 2.0 using .NET 2.0 |
+| -runtime30 | (switch) force running the EXE in PowerShell 3.0 using .NET 4.0 |
+| -lcid | specify language ID for threads |
+| -sta | run PowerShell environment in Single Thread Apartment mode |
+| -mta | run PowerShell environment in Multithread Apartment mode |
+| -noconsole | compile PS script as Windows application |
+
+
+
+Sample:
+
+*** MISSING SCREENSHOT ***
+
+This creates `test.exe` out of the PowerShell source file `test.ps1`
+
+Limitations: It’s not easy to create a fully functional PowerShell host such as `Console host` (powershell.exe) or `ISE` (powershell_ise.exe). So there may be functionality that does not work properly.
+
+
+
+The generated EXE can also be calls using command line options. There are 4 options that are used by the PowerShell host:
+
+| Switch | Description |
+| --- | --- |
+| -debug | Forces the EXE to be debugged. It calls “System.Diagnostics.Debugger.Break()”. |
+| -extract:”Filename” | Extracts the PowerShell script inside the EXE and saves it as “Filename”. The script will not be executed. |
+| -wait | At the end of the script execution it writes “Press a key…” and waits for a key to be pressed. |
+| -end | All following options will be passed to the script inside the EXE. All preceding options are used by the EXE and will not be passed to the script. |
+
+Sample:
+
+I create a script file containing this line of code:
+
+```PowerShell
+$args | Write-Host
+```
+
+I save it as `c:\test2.ps1` and convert it as EXE by using PS2EXE:
+
+*** MISSING SCREENSHOT ***
+
+Sample 1.: `-wait` forces the `Hit any key…` message. All options following `-end` will be passed to the script.
+
+Sample 2., 3. : The script will not get options preceding to `-end`.
+
+Sample 4: `-wait` follows to `-end` and so it’s passed to the script. No message `Hit any key…`.
+
+So. That’s it for the moment. Please feel free to modify the script and let me know.
+
+Possible tasks:
+
++ Sign the script inside the EXE with code signature
++ Sign the EXE with code signature
++ Compress the script inside the EXE
++ Improve the PSHost implementation inside the EXE.
+
+Have fun!
+
+
+
+
+#### New in v0.5.0.0 (14/11/2013):
+
++ support for PowerShell 4.0
++ VS project updated to VS2013 and .NET 4.0
+
+#### New in v0.4.0.0 (03/09/2013):
+
++ parameter -sta for running PowerShell in Single Thread Apartment mode
++ parameter -mta for running PowerShell in Multi Thread Apartment mode
++ parameter -noconsole to compile the resulting exe file als "Windows Application". the only implemented GUI interaction is for "get-credential"!!
++ Blog article coming soon...
+
+#### New in v0.3.0.0 (03/08/2013):
+
++ Support for PowerShell 3.0 and 2.0
++ Bug fixes (especially "Compilation fails - Assembly not referenced")
++ *see Blog Article*: http://blog.karstein-consulting.com/2013/03/08/update-of-ps2exe-version-0-3-0-0-now-supports-powershell-3-0-and-2-0/
+
+#### Here are the previous articles on my blog:
+[v0.2.0.0] https://blog.karstein-consulting.com/2012/04/30/ps2exe-v0-2-0-0-improvements-platform-switch-x64-or-x86-or-anycpu-new-exe-config-file-for-supported-runtime/
+[original] http://blog.karstein-consulting.com/2011/06/21/ps2exe-tool-for-converting-powershell-scripts-to-standalone-exe-files/
diff --git a/test.ps1 b/test.ps1
new file mode 100644
index 0000000..cde8430
--- /dev/null
+++ b/test.ps1
Binary files differ