PS2EXE-GUI: "Convert" PowerShell Scripts to EXE Files with GUI

Overworking of the great script of Ingo Karstein with GUI support. The GUI output and input is activated with one switch, real windows executables are generated. With Powershell 5.x support and graphical front end. Now here:
4.7 Star
37,204 times
Add to favorites
E-mail Twitter Digg Facebook
  • A couple of updates...
    4 Posts | Last post December 15, 2016
    • I've made a couple of changes to PS2EXE to fix a couple of issues (which I've documented below) I had with it. Is there some repo I can add a pull request or something, if you're interested in incorporating the changes...
      1. I've been having trouble with the icon file parameter, possibly because my script file's path contains spaces. In order to fix this, I changed ps2exe.ps1 to a) expect the icon file parameter to be a fully specified path (the same as $inputFile), and b) to place quotes round the '/win32icon' compiler option.
      2. I wanted to compile a script to run elevated. To do this, I added a command line switch named 'elevated' and when that was set $TRUE, added a compiler option to embed a manifest in the .EXE to specify that it be run as administrator.
    • Hello Stuart,
      I made a fork of Ingo Karstein's great script just to remove some errors and to make some basic improvements, since Ingo seems to have stopped working on it. I am not able to forward his script. I would advice you to make your own fork with your improvements.
      Especially the compiler option to specify a script to run as an administrator sounds very interesting, so it could be worth it.
    • Done - you can find it <a href="">here</a>
    • Hello Stuart,
      cool work. You implemented some great improvements.
  • So, this script only supports Windows Form and not WPF, right?
    2 Posts | Last post December 06, 2016
    • I am trying to build a GUI application based on WPF. 
      This script successfully converts the PS Script to EXE, but the EXE doesn't seem to work.
    • Hello Prvnkumar,
      I have to admit that I did not test WPF with PS2EXE, I just can't tell anything about.
      Is there an error message? Do you have a small Portion of example Code?
  • Parameters to exe
    2 Posts | Last post November 25, 2016
    • Hi,
      is it possible that the exe can accept parameters? I get a message in the console saying: Cannot find a provider with the name "Param(...)".
      This Messages also shows up, when using a function with parameters in the script.
      But the function seems to work.
    • OK my fault. The exe takes the actual path as working Directory. You don't need to check where it was startet when referencing in script.
  • MsgBox appears with no console output
    5 Posts | Last post November 04, 2016
    • Hi Markus,
      great rework, thanks!
      Hi have a problem with the "GUI function" if I run the script freom Powershell there is no log output in the console. When I start the same script as exe, I get messages like:
      "parent = -1 id = 0 act = Preparing modules for the first use.stat =  cur =  pct = -1 sec = -1 type = Completed" 
      I can't reproduce this mesage in the console.
      Is there an option to disable the GUI function like "-noGui".
      Auf Deutsch:
      Hallo Markus,
      danke für das weiterentwickeln des Scripts!
      Leider bekomme ich mit der wandelten ps Datei zur exe immer wieder Meldungen angezeigt die nicht aus meinem Script stammen, leider kann ich diese Meldungen auch nicht mit PowerShell in der Konsole nachstellen. die Meldung ist:
      "parent = -1 id = 0 act = Preparing modules for the first use.stat =  cur =  pct = -1 sec = -1 type = Completed" 
      Gibt es eine Möglichkeit die "GUI Funktion" zu deaktivieren? 
      Danke & Gruß
    • Hello PhHe,
      the reason for the message is easy explained: the method Write-Progress is not implemented in PS2EXE (not in the original version nor in mine), so powershell uses its built-in function to show the progress.
      Tony Pagliaro has already given the answer in a question to the original PS2EXE:
      $ProgressPreference= 'SilentlyContinue'
      # Do-Stuff
      $ProgressPreference= 'Continue'
      Please try to wrap the two commands around the critical section in your script and see whether it helps.
      What make me doubt a little in your case is the message behind "act =". What is "Preparing modules for the first use"?
    • Hi Markus,
      your solution seems to work for now, thanks!
      Maybe the Message "Preparing modules for the first use" is from calling scanstate.exe / loadstate.exe with start-process... this is the critical section.
    • Hello PhHe,
      I'm glad to hear this workaround works for you.
      I will investigate this strange behaviour (as far as I know it is new to Powershell V5.x) and hope I will find an solution to it.
      But, give me some days for it.
    • Hello PhHe,
      further analysis showed that there is a redundant handler for progress messages in PS2EXE and PS2EXE-GUI. I removed this handler and - after compiling - no "wrong" progress messages appear anymore. No need to work around with the variable $ProgressPreference.
      I updated the script PS2EXE-GUI, please download the new version.
181 - 184 of 184 Items