Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Convert PowerShell ps1 to EXE using native windows tool iexpress

Some times it is essentials to convert your codes to EXE. In my scenario when I try to provide script to end users and if I expect them not to modify the script before running or executing it, I can convert any cmd bat or PS1 script to EXE easily using native windows tool called iExpress.exe, and export them. This tool is very handy for normal ps1 script to convert to EXE.

You can launch the program just typing iExpress in the run. it is advised to run it as administrator.

iexpress Powershell microsoft convert ps1 to exe using native windows tool iexpress converter simple script.png

In the IExpress Wizard Create new Self Extraction Directive file. SED file store information about this package. If you have already done this, select Open existing one. otherwise select Create New Self Extraction Directive file, Next select Package purpose as Extract files and run an installation command, Files will be expanded to temporary folder.

Type the Title of your package in the box this title will appear on all dialog boxed that the user sees. For confirmation prompt select no prompt.

IEXPress 2 package purpose  extract installation ps1 to exe prompt wizard PowerShell converter ps1 exe.png

Choose the Do not display a License agreement.

MIcrosoft IEXPRESS license agreement dont powershell ps1 to exe converter powershell psm1 moduler.png

This is critical step, In the Packages files create a list of files that you want in your compressed package. Click add button and add ps1 files and all the supportive files.

Microsoft iexpress wizard convert ps1 to exe cmd command prompt powershell psm1 script to exe packaged filed add systeminfo.png

Once files are added you need to provide how the script will launch as like below command in the Install Program to Launch wizard, There is no post install command.

powershell.exe -ExecutionPolicy Unrestricted -File SystemInfo.ps1

Show window is set to Default recommended by default. No messages will be displayed after Finished message option.

iexpress wizard Powershell Windows Iexpress install program to launch executionpolicy unrestricted file ps1 to exe converter show windows finished message.pngGive a Package name. Configure restart to no restart. In the Save self Extraction Directive (SED) I am selected to not save the file. Go with the creating EXE file.

Microsoft windows native iExpress package name configure restart self extraction directive sed create package powershell ps1 to exe converter.png

You can view the summary of created package. it is successful. You can execute ps1 exe file to check the results.

Microsoft Windows iEXpress create package convert ps1 to exe powershell.png

Useful Articles
Microsoft PowerShell: Check Windows license activation status
Find next available free drive letter using PowerShell
Copy Files with PowerShell Remoting WINRM Protocol
Powershell Find application window state minimized or maximized
How to Install and Use Microsoft PowerShell on Linux
Configure PowerShell remoting between Windows and Linux
Get-PSRepository WARNING Unable to find module repositories
Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send
Creating an internal PowerShell module repository
How to sign PowerShell ps1 scripts
PowerShell Convert MAC address to Link-local address IPv6
PowerShell fix repair The trust relationship between this workstation and the primary domain failed
Resovled issue with PowerShell - Trust relationship Rejoin computers in domain without restart

Go Back

Comment

Blog Search

Page Views

11363250

Follow me on Blogarama