I'm using a linux docker image with powershell and few modules installed on it. Programmatically, my code do not see the modules.
For verification, if I start the image and instanciate powershell, I can run commands and confirm that the modules are installed: kubectl run -i --tty test --image=urlofimage:20211008.8 --command pwsh
However, my code do not see the modules. The extract of code below works in a windows machine, but returns the following error in the docker image:
This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.
internal const string NewSessionScript = "New-PSSession -ConfigurationName:Microsoft.Exchange -Authentication:Basic -ConnectionUri:{0} -Credential $cred -AllowRedirection";
this._runspace.SetCredential(userName, password);
var command = new PSCommand();
command.AddScript(string.Format(NewSessionScript, connectionUri));
var result = this._runspace.ExecuteCommand<PSSession>(command);
Question: It looks like the code is instanciating powershell "in memory" but does not use the powershell that is installed on the machine. How can I use it and leverage an image with all my powershell dependancies installed?