-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer
Milestone
Description
Steps to reproduce
-
Install OpenSSH on Windows Server 2016
-
Configure PowerShell as a subsystem
NOTE: Due to path issues, create a symlink or copy PowerShell Core to a directory without spaces
Subsystem powershell c:\powershell\pwsh.exe -sshs -NoLogo -NoProfile -
Connect from a linux or windows system
$session = New-PSSession -HostName hostname -UserName username
Enter-PSSession $sessionExpected behavior
The session is entered.
Actual behavior
The command fails
PS /home/psrptest> enter-pssession $session
enter-pssession : The 'Measure-Object' command was found in the module 'Microsoft.PowerShell.Utility', but the module could not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Utility'.
At line:1 char:1
+ enter-pssession $session
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Measure-Object:String) [Enter-PSSession], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModuleUsing Invoke-Command to invoke Test-Path on the session also produces an error due to failing to load 'Microsoft.PowerShell.Management'
PS /home/psrptest> Invoke-Command -Session $session -ScriptBlock {Test-Path -Path C:\Windows}
The 'Test-Path' command was found in the module 'Microsoft.PowerShell.Management', but the module could not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
+ CategoryInfo : ObjectNotFound: (Test-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
+ PSComputerName : psrpwinsrv.fsm0dauomfbubcgw4wlghhwv3d.yx.internal.cloudapp.net
Using Invoke-Command to examine $env:PSModulePath, it appears suspicious in that $PSHOME is the last entry in the apath.
PS /home/psrptest> Invoke-Command -Session $session -ScriptBlock {$PSHOME}
C:\powershell
PS /home/psrptest> Invoke-Command -Session $session -ScriptBlock {$env:PSModulePath}
C:\Users\psrptest\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules;c:\powershell\ModulesEnvironment data
> $PSVersionTable
Name Value
---- -----
PSRemotingProtocolVersion 2.3
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
GitCommitId 6.1.0-rc.1
PSEdition Core
OS Microsoft Windows 10.0.14393
Platform Win32NT
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PSVersion 6.1.0-rc.1Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer