Self Contained PowerShell Scripts

Anything you want to tell us? Praise? Criticism? Post it here. Please keep it professional and constructive.
Forum rules
Do not post any licensing information in this forum.
This topic is 5 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
ALIENQuake
Posts: 112
Last visit: Mon Jan 29, 2024 7:35 am
Has voted: 4 times

Self Contained PowerShell Scripts

Post by ALIENQuake »

Hello,

I would like to know if there are any plans/investigation for Windows Forms project types + Script Packager to:

1. Include all files from Powershell 5.1 (and probably some part of Net 4.5.2 files) into exe itself
2. Once PowerShell Core has moved over to .NET Core 3.0 with Forms, include all files from Powershell Core and Net Core 3 into exe itself

So we could have self Contained PowerShell Scripts, without "install Net and Powershell otherwise it crashes" requirements?

BTW: I don't care if the app will have 150Mb filesize or more, space is no longer an issue as of 2019
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Self Contained PowerShell Scripts

Post by Alexander Riedel »

That is a loaded question. But in general, no, there are no such plans.
I mean, to be sure we will support PowerShell Core and .NET Core 3 if and when it has Forms support.
But adding ALL PowerShell assemblies and the entire framework to a single exe? No, that is not feasible, even if you do not consider space.
Considering the amount of time it would take to JIT compile the framework and powershell prior to launching your script, it better come with a free drip coffee maker.
All jokes aside, runtimes, frameworks etc exist as a shared resource for a reason. You cannot run PowerShell without it being properly installed. There are not only size and speed consideration, there are also security implications. I mean, if you already go that far, why not deploy your app with its own OS on a bootable image? Then you would even eliminate Windows as a pre-requisite.

Usually you eliminate the hurdles of missing pre-requisites by installing an app and have the Windows Installer take care of also installing any required runtimes or other apps.

I am assuming you have some frustration with missing bits in your environment. Why don't you elaborate on the type of applications you create with some background on what difficulties you face? Maybe we can make a few suggestions how to handle that without booting a "PowerShell OS" from a flash drive :D
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
ALIENQuake
Posts: 112
Last visit: Mon Jan 29, 2024 7:35 am
Has voted: 4 times

Re: Self Contained PowerShell Scripts

Post by ALIENQuake »

First, let me address you concerns:
- you can run Powershell Core without installation, that's what Portable is for
- I'm not talking about JIT compiling framework, I'm talking about simple inclusion of NET + Powershell dll files
- security is no concern for me, my app is very simple and not executing as admin, besides, it's not the IDE/toolset to worry

next, let me present to you a scenario which I want to avoid
- after 10 years of broken application because of the NET updates, Microsoft finally acknowledge this problem and offer self-contained deployment of NET Core app. This is indisputable and I want the same for my app: ensure no dependency from shared NET so I can be sure that my app will work correctly 5 years from now
- the "let's ship whole os" argument is several magnitudes bigger and such concept it's not used by applications. Self-contained concept is used widley.

finally, I can't use windows installer
- my app is Portable out of the box, it dose't use any OS features (Right-Click entry etc) which require "Installation/UnInstallation", single exe
- Windows 7 support is highly important and using PS2 Host is not an option, I need Powershell 5.1 features

so I need a way to ship PS 5.1 and NET 4.5.2 for Windows 7. It's exactly the same situation as for Electron-based app: Electron ships local copy of Chrome. With self-contained exe, I could stop worrying about it. For me, nothing is more important.

I know that the chances for changing company vision by one random post are zero to none. But please reach to you customers (survey?) Such feature with the combination of that you are mention here: viewtopic.php?f=23&t=13612 looks fantastic for me.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Self Contained PowerShell Scripts

Post by Alexander Riedel »

Thanks for your detailed answer.
We are aware that with Core things go more the **nix way, which basically enables XCopy installs. We are monitoring this and see what can be done once the dust settles on this.
.NET and JIT, basically ALL .NET applications are ILASM code. Which needs to be JIT (Just in time) compiled before running. Windows Update usually Pre-compiles a new framework, a fix thereof etc when installing, which is why sometimes your computer fans howls like a jet engine and everything is sluggish for an hour or so without you doing so much.

I am aware of the problem you describe, rest assured. Windows developers have faced that all along with static linking versus dynamic linking, so none of this is new. :D
Security is a big concern for us, sorry. We need to make VERY sure we do not inadvertently create back doors. So yes, it is for us to worry about.

There is some technology available that *might* mitigate the issue, so I'll do some research.

In the meantime, you can post a feature request (https://www.sapien.com/requests) which will allow others to weigh in and vote on that.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
ALIENQuake
Posts: 112
Last visit: Mon Jan 29, 2024 7:35 am
Has voted: 4 times

Re: Self Contained PowerShell Scripts

Post by ALIENQuake »

Many thanks, I've made FR.
This topic is 5 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked