Compiling PowerShell 7 Scripts into an Executable in VS Code
HTML-код
- Опубликовано: 11 июл 2024
- In this video, I show you how to use PowerShell Pro Tools to compile a PowerShell 7 script into an executable in VS Code. The packaging process embeds the script, the .NET Core runtime as well as the PowerShell 7 runtime. The resulting executables are portable and can run on machines that do not have PS7 installed.
At the end of the video, I show how to package a script for execution on Linux. Currently, this feature is experimental.
To learn more about PowerShell Pro Tools, visit our website: ironmansoftware.com/powershel... - Наука
Nice, is there a way to not include the .net and pwsh stuff in the exe ? i just want a smal sized "app" without the overhead
It's likely possible but PoshTools doesn't work that way at the moment. Something I could certainly investigate.
Will this incorporate imported PS modules? Like RSAT modules? I'm looking for a way to run scripts without the need to install the module locally.
Store your modules in a network drive, then at the beginning of your script you can use the Import-Module command and point to the folder containing the necessary modules. Ideally, all your clients should be looking to a central location for all the modules running in your environment which become handy when you start creating your own modules.
Here when I try to generate the exe it gives the error: "PowerShell does not support debugging this file type: 'c:\test.psd1'
So I need a license to create the exe? I installed the tools and tried to package but I get a message that says I need a license. That would have been nice to know before I waisted my time.
We provide 14-day trials as to not completely waste your time. ironmansoftware.com/trial/powershell-pro-tools
doesn't seem to work for me.. just says "downloading powershell pro tools host (2023.2.0) at the bottom and never actually compiles the exe. says the term "merge-script" is not recognized as the name of a cmdlet.. etc"
Do you sleep?