WindowsCompatibility icon indicating copy to clipboard operation
WindowsCompatibility copied to clipboard

The client cannot connect to the destination specified in the request (localhost)

Open rjmholt opened this issue 6 years ago • 4 comments

From https://github.com/aspnet/AspNetCore.Docs/issues/12332.

Full description of the problem from @scottluskcis:

The first command succeeds but the Import-WinModule command fails with this error

PS C:\Users\MyUser> Import-WinModule Microsoft.PowerShell.LocalAccounts
New-PSSession : [localhost] Connecting to remote server localhost failed with th
e following error message : The client cannot connect to the destination specifi
ed in the request. Verify that the service on the destination is running and is
accepting requests. Consult the logs and documentation for the WS-Management ser
vice running on the destination, most commonly IIS or WinRM. If the destination
is the WinRM service, run the following command on the destination to analyze an
d configure the WinRM service: "winrm quickconfig". For more information, see th
e about_Remote_Troubleshooting Help topic.
At C:\Users\MyUser\Documents\PowerShell\Modules\WindowsCompatibility\1.0.0\Wi
ndowsCompatibility.psm1:232 char:20
+         $session = New-PSSession @newPSSessionParameters | Select-Obj ...
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : OpenError: (System.Management.A\u2026tion.RemoteRunspa
ce:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CannotConnect,PSSessionOpenFailed

I am trying this on Windows 8.1 Enterprise for example. Are there any additional steps that need to be mentioned in the NOTE?

rjmholt avatar May 08 '19 17:05 rjmholt

I managed to install it by Install-Module WindowsCompatibility -Scope CurrentUser without any issue.

But afterward, even for a simple Set-Location command, I got exactly the same bug above.

My Windows 10 version is very recently moved to the insider slow ring one : Microsoft Windows [version 10.0.18362.175]

My pwsh version is 6.2.1

copdips avatar Jun 24 '19 22:06 copdips

encounter the same problem on 7.0.1, already installed WindowsCompatibility

Import-WinModule Microsoft.PowerShell.Management New-PSSession: C:\Users\clu\Documents\PowerShell\Modules\WindowsCompatibility\1.0.0\WindowsCompatibility.psm1:232 Line | 232 | $session = New-PSSession @newPSSessionParameters | Select-Obj … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | [localhost] Connecting to remote server localhost failed with the following error message : The client | cannot connect to the destination specified in the request. Verify that the service on the destination | is running and is accepting requests. Consult the logs and documentation for the WS-Management service | running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run | the following command on the destination to analyze and configure the WinRM service: "winrm | quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.

Find-Module WindowsCompatibility

Version Name Repository Description


1.0.0 WindowsCompatibility PSGallery This module provides compatibility utili…

chucklu avatar Jul 08 '20 05:07 chucklu

@rjmholt https://docs.microsoft.com/en-us/windows/win32/winrm/installation-and-configuration-for-windows-remote-management

Run command Winrm quickconfig to enable Windows Remote Management first, then import module will work.

chucklu avatar Jul 08 '20 06:07 chucklu

In PowerShell 7, you should no longer need the WindowsCompatibility module. Instead try Import-Module -UseWindowsPowerShell <module>

rjmholt avatar Jul 08 '20 14:07 rjmholt