PowerShell is King–Invoke-EXE could help you run .EXE using PowerShell

During today’s Management Masters I did a demo on how and why to use application wrappers, in one of the demos I showed a function called Invoke-Exe and I thought I did publish that long time ago, but I did not, so here it is. Actually, there is two versions of this. One that always return the exit code from the app and then you can use that for conditioning, the other one checks that the return code is what you told it to be and if not it throws an error.

Invoke-EXE – Version 1



Invoke-EXE – Version 2



How to use them?

You can import them as modules and then execute (since they have the same function name, you cannot run them at the same time. If you nned to just rename one of the functions, or just use the function as a part of your script)

For version 1:

Invoke-EXE –Executable setup.exe –Arguments “/silent” –SuccessfulReturnCode 0

For version 2

Invoke-EXE –Executable setup.exe –Arguments “/silent”


Invoke-EXE –Executable setup.exe


Categories: Deployment, PowerShell

Tagged as: ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.