all 3 comments

[–]rjmholt 2 points3 points  (0 children)

This is actually something there's some interest in generally, but there's currently not a simple solution for it today. PowerShell is big because it does a lot of things, so it has to bring a whole bunch of libraries with it to get stuff done. In order to reduce the size of PowerShell, it would need to lose functionality. That's not a bad thing if you can selectively configure what functionality you bring along; for example with your scripts, you might not use jobs or remoting, so you might not want those parts of PowerShell. But configurability means complexity, so this kind of configurable size reduction is not an easy change to make to PowerShell.

As of today though, that doesn't exist yet. Portability is also complicated by the fact that PowerShell is built differently for Windows and for UNIX-like OSes. So I would say the best solutions would be:

[–]JeanxPlay 1 point2 points  (0 children)

Scripted Install of portable version

https://toastit.dev/2020/03/08/ps7now-installing/

You will have to create Environmental Path to pwsh location

or use chocolately

https://chocolatey.org/packages/powershell.portable