I’ve been working a powershell 5 project and started running into lots of problems with MSDefender, so I’m reworking the project to use powershell 7. but one side effect is the resultant exe is massive now. 200mb vs under 1mb previously by simply specifying powershell 7 and .net 7. I feel like I must be missing some option in the package.psd1 but I dont know what. any thoughts whats causing the bloat?
The PS7 packaging includes the entire PS7 and .NET Runtimes and that’s why it is so large. We have an option issue to build out a way to package just the compiled script but it would require an installation of PS7 on the target machine.
Did you try using the IronmanPowerShell host setting? It packages differently by not actually running the .NET compiler to produce the executable and tends to trigger AV as much.
Thanks for the feedback on the size with powershell 7.
As far as package hosts, I did try that with powershell 5 and then signed the exe with a code signing cert (albeit for testing, using one from our internal CA). virus total didn’t seem like that much different than if I used the .net compiler.
also, what would the option look like to create the package without powershell 7 embedded? I dont see it in the documentation
Its not an option yet, but there is an active request for it.