Start-RSJob - be able to import private functions
copdips opened this issue · comments
Many Powershell modules have the Private folder which contains the functions that the authors don't want to export them to the end users.
That means when an user types "gci function:", he won't see any these private functions after the module import.
It may happen that when an user uses Start-RSJob, inside the script block or the script file, some of the private functions need to be called.
The private functions are not PsModule, nor PsSnapin, nor functions already imported into the user's function:\ space, and nor in the callstack.
Currently, the only choice to achieve it is to import these function files at the beginning of inside the script block/file, but it will be imported as many times as the RSJob number.
It would be nice that these private functions files could be loaded directly and once into $InitialSessionState.
The more files to load, and the more RSJob created, the faster the data will be returned than the one by importing the files inside the script block/file.