The other day I was upgrading a SharePoint 2016 Server Farm from Windows Server 2012 R2 to Windows Server 2019. The inline upgrade went quite nicely, and everything worked like a charm after the upgrade, minus one thing. The SharePoint Management Console was throwing an error upon startup, and the same error message appeared when starting a normal Powershell session.
Add-PsSnapin : No snap-ins have been registered for Windows PowerShell version 5.
At C:\Program Files\Common Files\Microsoft Shared\Web Server
Extensions\16\CONFIG\POWERSHELL\Registration\SharePoint.ps1:3 char:1
+ Add-PsSnapin Microsoft.SharePoint.PowerShell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.SharePoint.PowerShell:String) [Add-PSSna
pin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
It seems that after the upgrade to Windows Server 2019, the Microsoft.SharePoint.PowerShell.dll was not registered with Windows, causing the error. However it was quite easy to remedy this situation, by using InstallUtil to re-register the DLL.
PS C:\WINDOWS\system32> C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil /LogToConsole=true C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint.PowerShell\v4.0_16.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.PowerShell.dll