MicrosoftDocs / windowsserverdocs

Public content repository for Windows Server content.
Creative Commons Attribution 4.0 International
1.34k stars 1.78k forks source link

OpenSSH PS script does not work on PS 7.2.1 #6306

Closed jgwinner closed 2 years ago

jgwinner commented 2 years ago

The step in the article to install OpenSSH does not work on Windows 10 or Windows 11.

I don't use PowerShell much, as I use TCC's replacement shell, so maybe there's some component that it needs, that isn't installed and not checked for.

PS C:\Windows\System32> Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
Get-WindowsCapability: Class not registered

My current Win10 particulars:

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

If I run an older powershell, it does work, however.

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\WINDOWS\system32> Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'

Name  : OpenSSH.Client~~~~0.0.1.0
State : Installed

Name  : OpenSSH.Server~~~~0.0.1.0
State : NotPresent

PS C:\WINDOWS\system32> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1320
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1320
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

jgwinner commented 2 years ago

This is why MS is going down :( the basics don't work and no one pays attention because "Triage".

Xelu86 commented 2 years ago

assign:xelu86

Xelu86 commented 2 years ago

Thanks again for contacting Microsoft. I went through the documentation outlined and was unable to reproduce the error "Get-WindowsCapability: Class not registered". This was tested on Windows 10 Pro 21H1 & Windows 11 22H2 in a VM and non-VM environment.

PowerShell 5.1 image

PowerShell 7.2 image

The Get-WindowsCapability command belongs to the DISM module. A list of associated DISM commands can be found by running: Import-module DISM -Verbose

The error encountered, "Class not registered", can be a software or hardware issue where the hard drive may potentially be unhealthy, or the OS is missing specific dll files or even corrupted. Generally, the following can be ran in the Windows Command Prompt to check for OS corruption:

1] DISM /Online /Cleanup-Image /ScanHealth (wait for this to complete). 2] DISM /Online /Cleanup-Image /RestoreHealth (once complete, reboot). 3] Once back in the command prompt, run: sfc /scannow.

There are several potential fixes to this issue depending on what is causing it. If you Google or Bing "Get-WindowsCapability: Class not registered error" you will find different remedies to this issue.

Thank you.

Xelu86 commented 2 years ago

please-close

jgwinner commented 1 year ago

THIS IS NOT A HARD DRIVE PROBLEM.

This is a "different versions of Windows have different base DLL's". It's well documented that this error occurs.

MS can't even fix their own O/S