Reputation: 31
Running powershell core using docker (official microsoft images), I am trying to set up a local session in my script so I can later execute code in that session.
I have tried using the following Linux Images:
6.2.3-alpine-3.8
6.2.3-centos-7
6.2.3-debian-9
6.2.3-ubuntu-18.04
In both alpine and debian I am getting error:
This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.
In both Centos & Ubuntu I am getting error:
MI_RESULT_ACCESS_DENIED
I tried digging the error but it was only mentioned in cases of trying to remote from linux to windows, while here all I am trying to do is open the most basic local session.
$FullCommand = "Invoke-Expression $CompleteScript"
$Session = New-PSSession
[scriptblock]$ScriptBlock = [scriptblock]::Create($FullCommand)
Invoke-Command -Session $Session -ScriptBlock $ScriptBlock
or
$Session = New-PSSession
Invoke-Expression -Session $Session -Command $CompleteScript
Before even moving on to remote sessions from linux to windows I would like to establish a local session and be able to execute code on it.
I am new to powershell so might be missing something, but I expected local session to work on at least one of microsoft's official docker images of powershell core, the documentation there didn't give me any insight on the issue.
Upvotes: 3
Views: 2958