Repository navigation
Ability to pass InitialSessionState to UnmangedPSEntry.Start - #17319
Staffan Gustafsson (powercode) wants to merge 5 commits into
Conversation
Adds an overload to UnmangedPSEntry.Start that accepts an InitialSessionState object, on par with the overloads for ConsoleShell.
Dongbo Wang (daxian-dbw)
left a comment
There was a problem hiding this comment.
Some passed in args may not be respected when the InitialSessionState is created before Start, the first one pops in my mind is -SettingsFile, which is supposed to overwrite the powershell.config.json at $pshome, but settings in that file may have been used already before calling Start.
What is the scenario for using this new overload?
Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
|
In a custom, internal, PowerShell distribution, I need to have a couple of base assemblies/modules loaded in the initial session even when starting without a profile. My idea was to replace pwsh.exe with my own version, that creates an initial session state with those assemblies/modules. If there is an alternative way to achieve this, I'm all ears! I also want to setup a ServiceProvider to enable dependency injection, and that could also be provided there. |
|
For reference: #17349 |
c9c8ec3 to
6cf2faa
Compare
6cf2faa to
fad285c
Compare
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
You must have evaluated |
Embarrassed to admit that I had missed ConsoleShell 😳. |
Adds an overload to UnmangedPSEntry.Start that accepts an InitialSessionState object, on par with the overloads for ConsoleShell.
PR Summary
Give more flexibility for custom hosts.
PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).