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.
4.7 Star
34,257 times
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

  • "Start-Process [process] -Wait" doesn't work on Windows 7
    2 Posts | Last post September 06, 2019
    • I used this tool to create an executable from a PowerShell script on my laptop (running Windows 10 64-bit, v1903). It worked great, I selected the options for run as admin as well as "noConsole" and tested on a couple Windows 10 machines.
      However, when I tested on a Windows 7 laptop I noticed that the "-Wait" flag wasn't respected (the commands executed fine, but didn't wait which caused issues with my verification logic).
      Is this a known issue? Is there a workaround?
    • Hello Jeffrey McClain,
      I guess this is a misunderstanding. When you compile a script with the option -NoConsole, a graphical program is generated. The shell does not wait for a graphical program to exit.
      You have to use start /wait (if started from cmd.exe) or Start-Process -Wait (from PowerShell) to instruct the shell to wait.
  • Retreive full path of current script
    2 Posts | Last post September 06, 2019
    • Hi,
      I used to start my powershell scripts with this snippet to get the full path of the directory containing the script without relying on a hard coded path:
      $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
      But after converting the script with ps2exe, $MyInvocation.MyCommand.Definition contains the full script content instead of its path.
      Is there another method to get the script's full path, or is it possible to fix ps2exe in order to keep this path into $MyInvocation.MyCommand.Definition?
      Many thanks in advance.
    • Hello Pini-ms,
      please see the Remarks section on this page for an explanation and a workaround.
  • Standalone executable
    2 Posts | Last post August 24, 2019
    • Hi,
      1. How about making the executable as standalone? so all .NET dll + Powershell .dll files are included inside executable. Main motivation is to be Independence from the build-in .NET/PS.
      2. How about extend above concept by allowing to use PS Core 7+, it uses NET Core 3.x
    • Hello ALIENQuake,
      as far as I know you can't pack a .Net installation into a standalone since .Net is highly integrated to the operating system. If I'm wrong you might explain how to do (or a have a link where it is explained).
      Because of the poor integration to Windows I have not examined PowerShell Core up to now, this may Change with PowerShell 7.
  • Can I get the exe file to run Powershell Console instead of cmd?
    2 Posts | Last post August 21, 2019
    • I have some lines in my script to do the Write-Progress while copying files, the progress bar still appears when I run the script using Powershell, but after I converted it to exe, the bar was not showed up in cmd console.
    • Hello prnt205,
      Write-Progress is not implemented if a "shell" program is compiled (no -NoConsole parameter). Because it is very complicated to implement, I have no plans to implement this. So Write-Progress is ignored.
      Sorry for that, greetings
  • Citrix calling process(citrix xenapp print)
    2 Posts | Last post August 17, 2019
    • Create a program that converts to exe. The user user accesses the application normally, but after publishing the application through Citrix xenapp 6.5, the program can be accessed normally. However, the printer mapped to the server by the xenapp client cannot print (client printer normal mapping) To the server side)
      After the process of logging in with the administrator account, it is found that the application after PowerShell Scripts cannot be called to open the following two processes, which causes the mapped printer to be unusable (the following two processes cannot be called after the ica protocol is logged in)
      C: Windows\splwow64.exe
      C: Windows\System32 \Server Manager Launcher.exe
      PowerShell Scripts scripts are as follows
      $secpasswd = ConvertTo-SecureString 'password' -AsPlainText -Force
      $mycreds = New-Object System.Management.Automation.PSCredential ("administrator", $secpasswd)
      Start-Process powershell -Credential $mycreds -ArgumentList " -noprofile -command &{Start-Process 'C:\windows\notepad.exe' -Verb Runas}"
      Start-Process powershell -Credential $mycreds -ArgumentList " -noprofile -command &{Start-Process 'C:\Windows\splwow64.exe' -Verb Runas}"
      Start-Process powershell -Credential $mycreds -ArgumentList " -noprofile -command &{Start-Process 'C:\Windows\System32\ServerManagerLauncher.exe' -Verb Runas}"
    • Hello xenapp,
      your script looks very strange to me. Why do you start a new instance of powershellnyounto start Notepad? Why do you start splwow64.exe manually, it gets started automatic by the Spooler Service on demand?
      Did you try to run your script "non-compiled"?
  • Cannot bind argument to parameter 'Path' because it is an empty string
    2 Posts | Last post August 17, 2019
    • Hello,
      I'm getting the following error when I run the executable.
      Cannot bind argument to parameter 'Path' because it is an empty string
      Any suggestions?  The script appears to compile the file.
      Thanks for your help!
    • Hello jc8856,
      what parameters does your script expect? What is the command line you are calling the compiled script?
  • citrix xenapp print
    2 Posts | Last post August 16, 2019
    • Through PS2EXE-GUI, the EXE application is made successfully and the access application is opened normally. But after publishing the application through Citrix xenapp 6.5, the program can be accessed normally. However, the printer mapped to the server by xenapp client can not print. Whether it is the user's right or not is a problem.
    • Hello xenapp,
      you give not enough information to me to help you.
      Are you sure there is an issue with PS2EXE? Did you try to run your script as a published application? Does the compiled script work when called in a published desktop? Does an error message appear? Does the script have other functions beside printing and are they working properly?
  • Start multiple other associated processes at the same time?
    2 Posts | Last post August 16, 2019
    • Can you set up in PowerShell Scripts to start multiple associated processes at the same time after starting the application? For example, start at the same time
      C: Windows splwow64.exe
      C: Windows System32 Server Manager Launcher.exe
    • Hello xenapp,
      I do not if I get your question right. PowerShell is processing commands sequentially. You can start processes in scripts by calling their names or with Start-Process, but that's only nearly at the same time.
  • Script compiled into EXE got detected as malicious
    5 Posts | Last post August 15, 2019
    • Hi Markus, I`m looking for your assistance.
      I wrote a simple script which just checks some WMI system objects and then executed windows commands, no network access, no registry changes, file creations \ deletions. 
      I got a few detections from Kaspesky AV, and uploaded exe to virus total:
      I tried to sign the exe but this not really changed the situation.
      As I`m pretty sure that script itself is not an issue, I tried to use Powershell Studio to compile script...  and it is working well:
      Could you please help me determine the possible reason for this?
    • turning off "-requireadmin" lowered amount of detections.. but still
    • Hello MaksymSo,
      I think I cannot help you. I compiled a sample script and checked it with Virustotal, two scanners thought of it as suspicious. That's not unusual.
      You could send your compiled script to Kaspersky so they can check it. Maybe you should not execute programs with names like "invoice.exe" or "important_document.exe" in your script because this IS suspicious.
    • I do not use such names - virustotal change name of the checked files.
      Okay, thank you.
    • Hello MaksymSo,
      sorry, I didn't know that Google uses those strange names in their sandboxes.
  • Powershell Script Converted to EXE fails when ran as Scheduled Task
    3 Posts | Last post August 14, 2019
    • I have a simple powershell script that uses robocopy to move files from directory to directory. I have ensured all the logging robocopy would typically do in the console is moved instead to a log file. I can run this exe and it works as expected when ran manually however when ran as a scheduled task I get the following issue: error: 3762504530 Application: test.exe
      Framework Version: v4.0.30319
      Description: The process was terminated due to an unhandled exception.
      Exception Info: System.InvalidOperationException
         at System.Windows.Forms.MessageBox.ShowCore(System.Windows.Forms.IWin32Window, System.String, System.String, System.Windows.Forms.MessageBoxButtons, System.Windows.Forms.MessageBoxIcon, System.Windows.Forms.MessageBoxDefaultButton, System.Windows.Forms.MessageBoxOptions, Boolean)
         at System.Windows.Forms.MessageBox.Show(System.String, System.String, System.Windows.Forms.MessageBoxButtons, System.Windows.Forms.MessageBoxIcon)
         at ik.PowerShell.PS2EXE.Main(System.String[])
    • Unchecking noConsole got rid of the error for me. Now the exe says it ran but it doesnt actually do anything.
    • Hello CodeBroJohn,
      there seems to be something different between your interactive environment and the environment of scheduled tasks and the program wants to tell you what. Please pipe the output and the error channel to a text file and see what's going wrong.
31 - 40 of 171 Items