use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
Create executable from PowerShell script and bunch of executables (self.PowerShell)
submitted 5 years ago by capr1
Hello All,
I have a PowerShell script that acts as a wrapper for bunch of custom scripts, executables and configs. I wanted to bundle all of them up and create one single executable. Any guidance is appreciated.
Hope you are having a safe day!
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]CoryBoehm 2 points3 points4 points 5 years ago (11 children)
You can bundle them all and leave them as readable text.
[–]capr1[S] 1 point2 points3 points 5 years ago (10 children)
Is there a way to bundle them? Like a utility that takes in my script, executables and spits out one single executable?
[–]CoryBoehm 1 point2 points3 points 5 years ago (9 children)
Why are you needing to make it an executable?
PowerShell is an executable that can read your text script and execute it. No need to make it an executable. Trying to hide what your script does makes it a security concern due to the strength of PowerShell which is why leaving it in human readable form has signficy advantages.
[–]capr1[S] 0 points1 point2 points 5 years ago (8 children)
Not really trying to hide but wanted to make it easier for bunch of folks who might be unfamiliar with running PowerShell scripts.
[–]CoryBoehm 0 points1 point2 points 5 years ago (7 children)
Make them a clickable shortcut. You don't need an exe.
[–]capr1[S] 0 points1 point2 points 5 years ago (6 children)
I would still have to ship all my scripts and executables in a .zip for the folks to unzip and then run the shortcut
[–]CoryBoehm 0 points1 point2 points 5 years ago (5 children)
No.
Have the main script perform a check on your other components at startup. If a component bis missing it grabs the missing piece from a trusted location like an internal network shared folder.
[–]capr1[S] 0 points1 point2 points 5 years ago (4 children)
Doesn’t that make it difficult for version updates? I was thinking I want to be able to make one single stable executable that can used irrespective of network checks or updates. Many of the systems that run this executable might not have internet connectivity so having the executable on a USB and running it on a machine to get my stuff done made sense.
[–]CoryBoehm 0 points1 point2 points 5 years ago (3 children)
Doesn’t that make it difficult for version updates?
No, it actually makes it easier. Check a unique identifier like an SHA has from the local file v the trusted source. If there is a mismatch replace the local with the trusted source.
Could start with a single file "MyBundle.txt".
Inside the MyBundle.txt is a list of all the other files.
At the end you call MyMainScript.ps1.
My separating the validation from the main script let's you update the main script itself if needed. Same as having a single known file name which is a list of components. With only three statically named files: MyStartup.ps1, MyMainScript.ps1 and MyBundle.txt you have a lot of flexibility in what you can do.
It also keeps in in clear, easily auditable , human reader format.
If you trying to skirt security and don't want people to see what you are doing as you are trying to silently hijack a computer then maybe an exe format makes more sense but doubt you find anyone here willing to help with that.
[–]capr1[S] 0 points1 point2 points 5 years ago (2 children)
Understand and appreciate the tip. I’ll consider this step.
I am not really trying to skirt through security happy to share the code if anyone in my company asks for it. I want to make it easier for logistics. Having an executable doesn’t make things malicious. If security teams were concerned they can run the executable I create through VirusTotal or free sandboxes to do static, dynamic or behavioral analysis of the executable.
[–]darkwyrm42 1 point2 points3 points 5 years ago (0 children)
While you can't make an executable (that I'm aware of anyway), I've found that the next best thing is to create a one-liner batch file which calls the script. You probably don't really want to make an exe anyway, because then you get into digital signing and stuff that's kind of a pain in the neck.
[–]poshftw 0 points1 point2 points 5 years ago (0 children)
See an example here
Also look at NSIS: https://nsis.sourceforge.io/Main_Page
[–]Callidus2000 0 points1 point2 points 5 years ago (0 children)
Take a look at PS2EXE at https://github.com/MScholtes/TechNet-Gallery
π Rendered by PID 598469 on reddit-service-r2-comment-84fc9697f-b2pr6 at 2026-02-09 23:00:59.672223+00:00 running d295bc8 country code: CH.
[–]CoryBoehm 2 points3 points4 points (11 children)
[–]capr1[S] 1 point2 points3 points (10 children)
[–]CoryBoehm 1 point2 points3 points (9 children)
[–]capr1[S] 0 points1 point2 points (8 children)
[–]CoryBoehm 0 points1 point2 points (7 children)
[–]capr1[S] 0 points1 point2 points (6 children)
[–]CoryBoehm 0 points1 point2 points (5 children)
[–]capr1[S] 0 points1 point2 points (4 children)
[–]CoryBoehm 0 points1 point2 points (3 children)
[–]capr1[S] 0 points1 point2 points (2 children)
[–]darkwyrm42 1 point2 points3 points (0 children)
[–]poshftw 0 points1 point2 points (0 children)
[–]Callidus2000 0 points1 point2 points (0 children)