PS2EXE : "Convert" PowerShell Scripts to EXE Files

This PowerShell script lets you "convert" PowerShell scripts into EXE files.

 
 
 
 
 
4.5 Star
(69)
74,981 times
Add to favorites
3/5/2015
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Crash message after closing application
    1 Posts | Last post June 14, 2018
    • Hello
      
      I have used your script/program to convert my Powershell script into an .EXE. As a Powershell script it worked fine and the .exe version also worked fine but when I close it or it finishes, I get a crash message. Is it something with my script, or have I made a mistake converting it? Honestly I have no clue why this is happening.
      Has anyone also expierienced this or can help?
      
      Thanks in advance
      Crowlex
  • PS2EXE and Excel
    1 Posts | Last post April 18, 2018
    • I wrote a script to manage multiple excel to convert to CSV and convert to custom Excel report.
      From the exe file I received, like the belows, error messages when it try to open the source excel files.
      Also other calls to methods or any other functions to Excel create an error messages, like the variables were null.
      The exe file, like the original script it's executed with the run as Administrator.
      I call the excel in this way:
      
      $ExcelWB=new-object -comobject excel.application
      $workbook=$ExcelWB.WoorkbooksOpen("$file")
      
      What I do wrong?
      
      ERROR: You cannot call a method on a null-valued expression.
      ERROR: Exception calling "Quit" with "0" argument(s): "Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))"
      ERROR: Exception setting "Visible": "Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))"
  • Two output of verbose in console
    2 Posts | Last post April 13, 2018
    • I wrote a windows application using Powershell code, when I the code in PS it shows single verbose output but after converting to EXE using PS2EXE (latest version) I do see two verbose output. Just for isolation purpose, created a simple PS with following line of code. 
      
    • Hello Pradeep-Papnai,
      
      since Ingo Karstein obviously does not work on PS2EXE anymore, I overworked his script so many errors are fixed. Among those errors are the "doubled" VERBOSE and WARNING handlers you suffer of: https://gallery.technet.microsoft.com/PS2EXE-GUI-Convert-e7cb69d5
      
      Greetings
      
      Markus
      
  • Produktversion
    2 Posts | Last post October 24, 2017
    • Hy Folks,
      is it possible to set a Produkt or Release Version to the exe File?
      
      Regardes Mike
    • Hello Mike-zdf,
      
      since Ingo Karstein does not develop PS2EXE any further, you have to use my version of PS2EXE (https://gallery.technet.microsoft.com/PS2EXE-GUI-Convert-e7cb69d5) or the one of Stuart Dootson to set version Information to the exe file.
      
      Greetings
      
      Markus
  • Hide Command Window
    3 Posts | Last post October 11, 2017
    • Is it possible to hide the black command window?
    • Hello Mike-zdf,
      
      try compiling your script with the additional parameter -noConsole
      
      Greetings
      
      Markus
    • Perfect.
      THX
      
       Mike
  • Get-Credential
    2 Posts | Last post September 24, 2017
    • The script I converted to exe has the Get-Credential option in it. When I run the exe as administrator I get the following text and error
      
      "cmdlet Get-Credential at command pipeline position 1
      Supply values for the following parameters:
      Credential:
      Exception in ik.PowerShell.PS2EXEHostUI.Prompt*2
      Windows PowerShell credential request
      Enter your credentials.
      User name: admin
      Cannot process argument transformation on parameter 'Credential'. Cannot process argument because the value of argument
      "password" is null. Change the value of argument "password" to a non-null value."
      
      as you can see it asks me for my user name but never asks for a password.  Is there anyway to fix this?
      
      Ryan B.
    • Hello RBleinin,
      
      this is an error in PS2EXE. Since Ingo Karstein obviously does not work on PS2EXE anymore, you can try my overworking that has this error fixed (among others):
      
      https://gallery.technet.microsoft.com/PS2EXE-GUI-Convert-e7cb69d5
      
      
      Greetings
      
      Markus
      
  • Version Error
    2 Posts | Last post September 08, 2017
    • We are running powershell version 5.1.  When I try to run your converter, it returns the error "THE POWERSHELL VERSION IS UNKNOWN!".  I redownloaded the above zip, but same issue.  Please advise.
    • Hello dottkp,
      
      it seems that Ingo Karstein does not improve his script anymore. So you have two choices:
      
      1. Change line 74 of ps2exe.ps1 from
      
      if($PSVersionTable.PSVersion.Major -eq 4) {
      
      to
      
      if($PSVersionTable.PSVersion.Major -ge 4) {
      
      2. Use one of the further developments of ps2exe
      
      The one from Rengifo, from Stuart Dootson or mine (https://gallery.technet.microsoft.com/PS2EXE-GUI-Convert-e7cb69d5).
      
      
      Greetings
      
      Markus
      
  • Problem with modules after compilation.
    1 Posts | Last post August 23, 2017
    • Sorry in advance if I haven't found answer to this question - I searched though.
      The issue is that when I run my script as .ps1 - all modules, GUI and functionality behaves as intended, though if I compile it to .exe - modules seems not to be working. All the functionality, except parts where scripts needs to work with PSRemoteRegistry and Quest AD snippet, works.
      Is there something in exe config file I am missing? Or something in compilation script I need to amend/alter?
  • virus detection
    1 Posts | Last post August 22, 2017
    • I have been using this to create exe and it works great.  but recently, my scripts are getting caught as trojans?  If i submit my ps1 to vt, it is clean, but if i submit my exe to vt it comes back with a detection.  is there something i need to do to avoid this.
      
      thanks
  • There is an issue with adding an icon
    1 Posts | Last post August 09, 2017
    • Providing an icon filename results in errors unless I place it in the c:\Windows\System32.  The problem appears to start at line 218:
      
      $iconFileParam = ""
      if(!([string]::IsNullOrEmpty($iconFile))) {
      	$iconFileParam = "/win32icon:$($iconFile)"
      }
      
      This will always result in the $iconFileParam resolving to the c:\Windows\System32 directory if you provide a file name.  I modified it to the following and it worked as expected:
      
      $iconFileParam = ""
      if(!([string]::IsNullOrEmpty($iconFile))) {
      	$iconFileParam = (join-path (split-path $inputFile) $iconFile)
      }
1 - 10 of 83 Items