Get-WindowsOptionalFeature -Online
>Get-WindowsOptionalFeature: Class not registered
get-error
Exception :
Type : System.Runtime.InteropServices.COMException
ErrorCode : -2147221164
TargetSite :
Name : ThrowTerminatingError
DeclaringType : System.Management.Automation.MshCommandRuntime, System.Management.Automation, Version=7.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
StackTrace :
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
Message : Class not registered
Source : System.Management.Automation
HResult : -2147221164
CategoryInfo : NotSpecified: (:) [Get-WindowsOptionalFeature], COMException
FullyQualifiedErrorId : Microsoft.Dism.Commands.GetWindowsOptionalFeatureCommand
InvocationInfo :
MyCommand : Get-WindowsOptionalFeature
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 1
Line : Get-WindowsOptionalFeature -Online
PositionMessage : At line:1 char:1
+ Get-WindowsOptionalFeature -Online
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Get-WindowsOptionalFeature
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
$PSVersionTable
Name Value
---- -----
PSVersion 7.0.3
PSEdition Core
Get-WindowsOptionalFeature -Online
FeatureName : Printing-PrintToPDFServices-Features
State : Enabled
FeatureName : Windows-Defender-Default-Definitions
State : Disabled
FeatureName : Printing-XPSServices-Features
State : Enabled
...
Error: Get-WindowsOptionalFeature: Class not registered
$PSVersionTable
Name Value
---- -----
PSVersion 7.1.0-rc.2
PSEdition Core
GitCommitId 7.1.0-rc.2
OS Microsoft Windows 10.0.20211
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0鈥
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Type : System.Runtime.InteropServices.COMException ErrorCode : -2147221164
/cc @daxian-dbw @SeeminglyScience who could comment the exception.
@brwilkinson does it work in Windows PowerShell? I can't repro which makes me lean towards it being an issue with the Windows build you're on.
Can anyone else on the Windows 10 dev channel repro?
This works on my system with 7.1-rc2 and Windows 20H2 (build 19042). That COMException simply means the cmdlet is trying to use a COM object that isn't found. @brwilinson, is your repro showing that on the same system 7.0.3 works, but 7.1-rc2 does not?
Microsoft Windows 10.0.20211
I believe it is better to use Windows Feedback tool to report the issue.
@SteveL-MSFT yes correct
$PSVersionTable
PSVersion 5.1.20211 <-- works as expected
PSVersion 7.0.3 <-- works as expected
PSVersion 7.1.0-rc.2 <-- hangs for quite a while (assuming a COM timeout), then fails with the COMException.
Get-WindowsOptionalFeature: Class not registered
Repros on both of my main machines.
My second machine is running a later version: Microsoft Windows 10.0.20241
I just tried this on my machine:
> systeminfo | select -first 2 -skip 2
OS Name: Microsoft Windows 10 Enterprise Insider Preview
OS Version: 10.0.21246 N/A Build 21246
> Get-WindowsOptionalFeature -Online
FeatureName : Printing-PrintToPDFServices-Features
State : Enabled
FeatureName : Windows-Defender-Default-Definitions
State : Disabled
FeatureName : Printing-XPSServices-Features
State : Enabled
FeatureName : SearchEngine-Client-Package
State : Enabled
FeatureName : TelnetClient
State : Disabled
FeatureName : TFTP
State : Disabled
FeatureName : TIFFIFilter
State : Disabled
FeatureName : WorkFolders-Client
State : Enabled
FeatureName : LegacyComponents
State : Disabled
FeatureName : DirectPlay
State : Disabled
FeatureName : Printing-Foundation-Features
State : Enabled
FeatureName : Printing-Foundation-InternetPrinting-Client
State : Enabled
FeatureName : Printing-Foundation-LPDPrintService
State : Disabled
FeatureName : Printing-Foundation-LPRPortMonitor
State : Disabled
FeatureName : MSRDC-Infrastructure
State : Enabled
FeatureName : HypervisorPlatform
State : Disabled
FeatureName : VirtualMachinePlatform
State : Enabled
FeatureName : Windows-Identity-Foundation
State : Disabled
FeatureName : Microsoft-Windows-Subsystem-Linux
State : Enabled
FeatureName : MicrosoftWindowsPowerShellV2Root
State : Enabled
FeatureName : MicrosoftWindowsPowerShellV2
State : Enabled
FeatureName : Client-ProjFS
State : Enabled
FeatureName : SimpleTCP
State : Disabled
FeatureName : NetFx4-AdvSrvs
State : Enabled
FeatureName : NetFx4Extended-ASPNET45
State : Disabled
FeatureName : IIS-WebServerRole
State : Disabled
FeatureName : IIS-WebServer
State : Disabled
FeatureName : IIS-CommonHttpFeatures
State : Disabled
FeatureName : IIS-HttpErrors
State : Disabled
FeatureName : IIS-HttpRedirect
State : Disabled
FeatureName : IIS-ApplicationDevelopment
State : Disabled
FeatureName : IIS-Security
State : Disabled
FeatureName : IIS-RequestFiltering
State : Disabled
FeatureName : IIS-NetFxExtensibility
State : Disabled
FeatureName : IIS-NetFxExtensibility45
State : Disabled
FeatureName : IIS-HealthAndDiagnostics
State : Disabled
FeatureName : IIS-HttpLogging
State : Disabled
FeatureName : IIS-LoggingLibraries
State : Disabled
FeatureName : IIS-RequestMonitor
State : Disabled
FeatureName : IIS-HttpTracing
State : Disabled
FeatureName : IIS-URLAuthorization
State : Disabled
FeatureName : IIS-IPSecurity
State : Disabled
FeatureName : IIS-Performance
State : Disabled
FeatureName : IIS-HttpCompressionDynamic
State : Disabled
FeatureName : IIS-WebServerManagementTools
State : Disabled
FeatureName : IIS-ManagementScriptingTools
State : Disabled
FeatureName : IIS-IIS6ManagementCompatibility
State : Disabled
FeatureName : IIS-Metabase
State : Disabled
FeatureName : WAS-WindowsActivationService
State : Disabled
FeatureName : WAS-ProcessModel
State : Disabled
FeatureName : WAS-NetFxEnvironment
State : Disabled
FeatureName : WAS-ConfigurationAPI
State : Disabled
FeatureName : IIS-HostableWebCore
State : Disabled
FeatureName : IIS-StaticContent
State : Disabled
FeatureName : IIS-DefaultDocument
State : Disabled
FeatureName : IIS-DirectoryBrowsing
State : Disabled
FeatureName : IIS-WebDAV
State : Disabled
FeatureName : IIS-WebSockets
State : Disabled
FeatureName : IIS-ApplicationInit
State : Disabled
FeatureName : IIS-ASPNET
State : Disabled
FeatureName : IIS-ASPNET45
State : Disabled
FeatureName : IIS-ASP
State : Disabled
FeatureName : IIS-CGI
State : Disabled
FeatureName : IIS-ISAPIExtensions
State : Disabled
FeatureName : IIS-ISAPIFilter
State : Disabled
FeatureName : IIS-ServerSideIncludes
State : Disabled
FeatureName : IIS-CustomLogging
State : Disabled
FeatureName : IIS-BasicAuthentication
State : Disabled
FeatureName : IIS-HttpCompressionStatic
State : Disabled
FeatureName : IIS-ManagementConsole
State : Disabled
FeatureName : IIS-ManagementService
State : Disabled
FeatureName : IIS-WMICompatibility
State : Disabled
FeatureName : IIS-LegacyScripts
State : Disabled
FeatureName : IIS-LegacySnapIn
State : Disabled
FeatureName : IIS-FTPServer
State : Disabled
FeatureName : IIS-FTPSvc
State : Disabled
FeatureName : IIS-FTPExtensibility
State : Disabled
FeatureName : WCF-Services45
State : Enabled
FeatureName : WCF-HTTP-Activation45
State : Disabled
FeatureName : WCF-TCP-Activation45
State : Disabled
FeatureName : WCF-Pipe-Activation45
State : Disabled
FeatureName : WCF-MSMQ-Activation45
State : Disabled
FeatureName : WCF-TCP-PortSharing45
State : Enabled
FeatureName : MSMQ-Container
State : Disabled
FeatureName : MSMQ-DCOMProxy
State : Disabled
FeatureName : MSMQ-Server
State : Disabled
FeatureName : MSMQ-ADIntegration
State : Disabled
FeatureName : MSMQ-HTTP
State : Disabled
FeatureName : MSMQ-Multicast
State : Disabled
FeatureName : MSMQ-Triggers
State : Disabled
FeatureName : WCF-HTTP-Activation
State : Disabled
FeatureName : WCF-NonHTTP-Activation
State : Disabled
FeatureName : IIS-CertProvider
State : Disabled
FeatureName : IIS-WindowsAuthentication
State : Disabled
FeatureName : IIS-DigestAuthentication
State : Disabled
FeatureName : IIS-ClientCertificateMappingAuthentication
State : Disabled
FeatureName : IIS-IISCertificateMappingAuthentication
State : Disabled
FeatureName : IIS-ODBCLogging
State : Disabled
FeatureName : NetFx3
State : Enabled
FeatureName : SMB1Protocol
State : Disabled
FeatureName : SMB1Protocol-Client
State : Disabled
FeatureName : SMB1Protocol-Server
State : Disabled
FeatureName : SMB1Protocol-Deprecation
State : Disabled
FeatureName : MediaPlayback
State : Enabled
FeatureName : WindowsMediaPlayer
State : Enabled
FeatureName : Containers-DisposableClientVM
State : Disabled
FeatureName : Microsoft-Hyper-V-All
State : Enabled
FeatureName : Microsoft-Hyper-V
State : Enabled
FeatureName : Microsoft-Hyper-V-Tools-All
State : Enabled
FeatureName : Microsoft-Hyper-V-Management-PowerShell
State : Enabled
FeatureName : Microsoft-Hyper-V-Hypervisor
State : Enabled
FeatureName : Microsoft-Hyper-V-Services
State : Enabled
FeatureName : Microsoft-Hyper-V-Management-Clients
State : Enabled
FeatureName : HostGuardian
State : Disabled
FeatureName : Client-DeviceLockdown
State : Disabled
FeatureName : Client-EmbeddedShellLauncher
State : Disabled
FeatureName : Client-EmbeddedBootExp
State : Disabled
FeatureName : Client-EmbeddedLogon
State : Disabled
FeatureName : Client-KeyboardFilter
State : Disabled
FeatureName : Client-UnifiedWriteFilter
State : Disabled
FeatureName : DataCenterBridging
State : Disabled
FeatureName : DirectoryServices-ADAM-Client
State : Disabled
FeatureName : Windows-Defender-ApplicationGuard
State : Disabled
FeatureName : ServicesForNFS-ClientOnly
State : Disabled
FeatureName : ClientForNFS-Infrastructure
State : Disabled
FeatureName : NFS-Administration
State : Disabled
FeatureName : Containers
State : Disabled
FeatureName : Containers-HNS
State : Disabled
FeatureName : Containers-SDN
State : Disabled
FeatureName : SmbDirect
State : Enabled
FeatureName : MultiPoint-Connector
State : Disabled
FeatureName : MultiPoint-Connector-Services
State : Disabled
FeatureName : MultiPoint-Tools
State : Disabled
FeatureName : AppServerClient
State : Disabled
FeatureName : Internet-Explorer-Optional-amd64
State : Enabled
Two things @brwilkinson:
Because this is done by Dism, which touches COM directly itself (rather than going through PowerShell), this may be caused by changes in .NET rather than in PowerShell.
I am OOF at the moment, can test it when back on keyboard.
@rjmholt by any chance could you test with the store Preview msix version.
Ok, I can repro this from Store installed one. I suspect it's due to registry virtualization which isn't supposed to be active.