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.

PS2EXE-GUI.zip
 
 
 
 
 
4.7 Star
(35)
33,085 times
Add to favorites
7/1/2019
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Citrix calling process(citrix xenapp print)
    2 Posts | Last post Sat 4:08 AM
    • 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"?
      
      Greetings
      
      Markus
  • Cannot bind argument to parameter 'Path' because it is an empty string
    2 Posts | Last post Sat 3:53 AM
    • 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!
      Jason
    • Hello jc8856,
      
      what parameters does your script expect? What is the command line you are calling the compiled script?
      
      Greetings
      
      Markus
  • citrix xenapp print
    2 Posts | Last post Fri 12:46 AM
    • 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?
      
      Greetings
      
      Markus
  • Start multiple other associated processes at the same time?
    2 Posts | Last post Fri 12:40 AM
    • 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.
      
      Greetings
      
      Markus
  • Script compiled into EXE got detected as malicious
    5 Posts | Last post Thu 12:18 AM
    • 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:
      https://www.virustotal.com/gui/file/ed194f0735513f26f42979c47b9ea3e6f13003a8d7b213f254c78f3edd01f298
      https://www.virustotal.com/gui/file/655500329326af0bb3b89b7fb68d62fd1b76b0c54134b30855534bc0942a70fa
      
      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:
      
      https://www.virustotal.com/gui/file/8dc66b07472795c9787b027966ef4e7df34e45bf214165a221f376f49c953a88/detection
      
      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.
      
      Greetings
      
      Markus
    • 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.
      
      Greetings
      
      Markus
  • 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.
      
      Greetings
      
      Markus
  • Passing arguement
    5 Posts | Last post August 09, 2019
    • Hi Markus, I used PS2exe for converting .ps1 file. My ps1 file takes 2 arguments during installation. ie, .\my.ps1 "arg1","arg2". arg1 is used by an exe for installation. When I run from ps1, the exe takes arg1 as per the required logic but when I run ps2exe converted exe it takes both the arguments(arg1 and arg2)as input parameter which is causing issue. I verified the same by running process explorer. It would be very kind of you if you could help me.
    • Hello Abby Potter,
      
      I can explain this behaviour, but can not do anything about it because it's not under PS2EXE's control. When you pass "arg1","arg2" to a PowerShell script, an Array is passed to the script. If you pass "arg1","arg2" to an executable, the shell passes a string to the executable. So the string with the value "arg1","arg2" is the first parameter.
      
      Is it possible for you to set a blank after the comma? Could you omit the comma? This might work.
      
      Greetings
      
      Markus
    • Hi Marcus, I believe I found the issue. When I was compiling to EXE I was using an older PS2EXE.ps1 powershell and not the one that was in your folder. When I tried your PS2EXE.ps1 the parameters now work.
      The path of my environment variable was kicking off another version of PS2EXE. 
      Thank you for all your help :)
      
    • Hello Alice Martini,
      
      are you sure you're answering to the correct question?
      
      Greetings
      
      Markus
    • Oops, sorry for the wrong post. 
  • Include multiple files.
    2 Posts | Last post August 07, 2019
    • How can i modify this script so that i can include multiple files in the exe?
    • Hello Jerald4lyfe,
      
      I think I cannot fulfill the wish you have. There are to many things PS2EXE would have to determine or could not predict: the path to a sub script might have to be evaluated at runtime, variables might have a (sub) script scope, parameters to sub scripts have to be handled, script variables might have different values in sub scripts...
      
      Maybe a tool that generates self extracting archives would be better for you.
      
      Greetings
      
      Markus
  • Thank you, Markus!
    2 Posts | Last post August 07, 2019
    • I compiled the script on a Win7 PC and the EXE is working perfectly. It's no problem for us to have a separate EXE for Win10 and one for Win7. I appreciate your advice, thanks again!
    • You're welcome.
      
      Greetings
      
      Markus
  • Adding to my question
    2 Posts | Last post August 04, 2019
    • Sorry, I don't see an edit button for my previous post. I do have .Net Framework 4.7.2 on the Windows 7 PCs. The PowerShell version on the PC in question is 2.0.
    • Hallo Carl,
      
      PowerShell 2.0 always runs with .Net 2 up to .Net 3.51 and cannot use .Net 4.xx. You have two options:
      1. Compile your script with PowerShell 2.0 on your Windows 7 PC (this executable will fail on your Windows 10 PC if there is no PowerShell 2.0 present)
      2. Install WMF 3 or up on your Windows 7 PC, so PowerShell 3 or up are present
      
      Greetings
      
      Markus
1 - 10 of 137 Items