Repository navigation
Closed
Description
Windows Version
10.0.26120
WSL Version
2.6.0.0
Are you using WSL 1 or WSL 2?
-
WSL 2
-
WSL 1
Kernel Version
6.6.87.2-1
Distro Version
The .MSIXBundle from WhitewaterFoundry/Fedora-Remix-for-WSL/releases/tag/42.0.5
Other Software
Get-AppxPackage Microsoft.PowerShellPreview | Format-List returns:
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US ResourceId : InstallLocation : C:\Program Files\WindowsApps\Microsoft.PowerShellPreview_7.6.4.0_x64__8wekyb3d8bbwe IsFramework : False IsResourcePackage : False IsBundle : False IsDevelopmentMode : False NonRemovable : False IsPartiallyStaged : False SignatureKind : Store Status : Ok
Repro Steps
#!/usr/bin/env pwsh
#Requires -PSEdition Core
#Requires -Version 7.6.0
If ($IsWindows) {
$OutFile = "$Home" + [IO.Path]::DirectorySeparatorChar + 'collect-wsl-logs.ps1'
Invoke-WebRequest `
-URI 'https://github.com/microsoft/WSL/raw/902848b76bcdcf55438ba99e584d852f48c03859/diagnostics/collect-wsl-logs.ps1' `
-OutFile "$OutFile"
& $('./' + [IO.Path]::DirectorySeparatorChar + "$OutFile")
}Expected Behavior
It should operate.
Actual Behavior
As I've explained at #13169 (comment), 902848b76bcdcf55438ba99e584d852f48c03859/diagnostics/collect-wsl-logs.ps1, it fails:
Details
Evidential Logs
PS C:\Users\rokej> Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1 PS C:\Users\rokej> Set-ExecutionPolicy Bypass -Scope Process -Force PS C:\Users\rokej> .\collect-wsl-logs.ps1 Get-WindowsOptionalFeature: C:\Users\rokej\collect-wsl-logs.ps1:57 Line | 57 | Get-WindowsOptionalFeature -Online > $folder/optional-components.txt | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Class not registered 100% [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]e press any key to save the logs.
...as the subsequent section confirms.
Diagnostic Logs
See #13166 (comment):
If the
CLIXMLproves it,Get-Error | Export-CLIXML "$Filename"returns:<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"> <Obj RefId="0"> <TN RefId="0"> <T>System.Management.Automation.ErrorRecord#PSExtendedError</T> <T>System.Object</T> </TN> <ToString>Class not registered_x000D__x000A_</ToString> <MS> <Obj N="Exception" RefId="1"> <TN RefId="1"> <T>System.Runtime.InteropServices.COMException</T> <T>System.Runtime.InteropServices.ExternalException</T> <T>System.SystemException</T> <T>System.Exception</T> <T>System.Object</T> </TN> <ToString>System.Runtime.InteropServices.COMException (0x80040154): Class not registered_x000D__x000A__x000D__x000A_ at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)</ToString> <Props> <I32 N="ErrorCode">-2147221164</I32> <S N="TargetSite">Void ThrowTerminatingError(System.Management.Automation.ErrorRecord)</S> <S N="Message">Class not registered_x000D__x000A_</S> <Obj N="Data" RefId="2"> <TN RefId="2"> <T>System.Collections.ListDictionaryInternal</T> <T>System.Object</T> </TN> <DCT /> </Obj> <Nil N="InnerException" /> <Nil N="HelpLink" /> <S N="Source">System.Management.Automation</S> <I32 N="HResult">-2147221164</I32> <S N="StackTrace"> at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)</S> </Props> </Obj> <Nil N="TargetObject" /> <S N="FullyQualifiedErrorId">Microsoft.Dism.Commands.GetWindowsOptionalFeatureCommand</S> <Obj N="InvocationInfo" RefId="3"> <TN RefId="3"> <T>System.Management.Automation.InvocationInfo</T> <T>System.Object</T> </TN> <ToString>System.Management.Automation.InvocationInfo</ToString> <Props> <Obj N="MyCommand" RefId="4"> <TN RefId="4"> <T>System.Management.Automation.CmdletInfo</T> <T>System.Management.Automation.CommandInfo</T> <T>System.Object</T> </TN> <ToString>Get-WindowsOptionalFeature</ToString> <Props> <S N="Verb">Get</S> <S N="Noun">WindowsOptionalFeature</S> <S N="HelpFile">Microsoft.Dism.PowerShell.dll-Help.xml</S> <Nil N="PSSnapIn" /> <Version N="Version">3.0</Version> <S N="ImplementingType">Microsoft.Dism.Commands.GetWindowsOptionalFeatureCommand</S> <S N="Definition">_x000D__x000A_Get-WindowsOptionalFeature -Path <string> [-FeatureName <string>] [-PackageName <string>] [-PackagePath <string>] [-WindowsDirectory <string>] [-SystemDrive <string>] [-LogPath <string>] [-ScratchDirectory <string>] [-LogLevel <LogLevel>] [<CommonParameters>]_x000D__x000A__x000D__x000A_Get-WindowsOptionalFeature -Online [-FeatureName <string>] [-PackageName <string>] [-PackagePath <string>] [-WindowsDirectory <string>] [-SystemDrive <string>] [-LogPath <string>] [-ScratchDirectory <string>] [-LogLevel <LogLevel>] [<CommonParameters>]_x000D__x000A_</S> <Nil N="DefaultParameterSet" /> <Obj N="OutputType" RefId="5"> <TN RefId="5"> <T>System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.PSTypeName, System.Management.Automation, Version=7.6.0.4, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T> <T>System.Object</T> </TN> <LST> <S>System.Collections.Generic.List`1[[Microsoft.Dism.Commands.BasicFeatureObject, Microsoft.Dism.PowerShell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=null]]</S> <S>Microsoft.Dism.Commands.AdvancedFeatureObject</S> </LST> </Obj> <S N="Options">ReadOnly</S> <S N="Name">Get-WindowsOptionalFeature</S> <S N="CommandType">Cmdlet</S> <S N="Source">Dism</S> <S N="Visibility">Public</S> <S N="ModuleName">Dism</S> <S N="Module">Dism</S> <S N="RemotingCapability">PowerShell</S> <Obj N="Parameters" RefId="6"> <TN RefId="6"> <T>System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Management.Automation.ParameterMetadata, System.Management.Automation, Version=7.6.0.4, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T> <T>System.Object</T> </TN> <DCT> <En> <S N="Key">FeatureName</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">PackageName</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">PackagePath</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">Path</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">Online</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">WindowsDirectory</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">SystemDrive</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">LogPath</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">ScratchDirectory</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">LogLevel</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">Verbose</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">Debug</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">ErrorAction</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">WarningAction</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">InformationAction</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">ProgressAction</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">ErrorVariable</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">WarningVariable</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">InformationVariable</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">OutVariable</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">OutBuffer</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> <En> <S N="Key">PipelineVariable</S> <S N="Value">System.Management.Automation.ParameterMetadata</S> </En> </DCT> </Obj> <Obj N="ParameterSets" RefId="7"> <TN RefId="7"> <T>System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.CommandParameterSetInfo, System.Management.Automation, Version=7.6.0.4, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T> <T>System.Object</T> </TN> <LST> <S>-Path <string> [-FeatureName <string>] [-PackageName <string>] [-PackagePath <string>] [-WindowsDirectory <string>] [-SystemDrive <string>] [-LogPath <string>] [-ScratchDirectory <string>] [-LogLevel <LogLevel>] [<CommonParameters>]</S> <S>-Online [-FeatureName <string>] [-PackageName <string>] [-PackagePath <string>] [-WindowsDirectory <string>] [-SystemDrive <string>] [-LogPath <string>] [-ScratchDirectory <string>] [-LogLevel <LogLevel>] [<CommonParameters>]</S> </LST> </Obj> </Props> <MS> <S N="Namespace">Dism</S> <S N="HelpUri">https://go.microsoft.com/fwlink/?LinkId=289358</S> <S N="DLL">C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Dism\Microsoft.Dism.PowerShell.dll</S> </MS> </Obj> <Obj N="BoundParameters" RefId="8"> <TN RefId="8"> <T>System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]</T> <T>System.Object</T> </TN> <DCT /> </Obj> <Obj N="UnboundArguments" RefId="9"> <TN RefId="9"> <T>System.Collections.Generic.List`1[[System.Object, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]</T> <T>System.Object</T> </TN> <LST /> </Obj> <I32 N="ScriptLineNumber">57</I32> <I32 N="OffsetInLine">1</I32> <I64 N="HistoryId">3</I64> <S N="ScriptName">C:\Users\rokej\collect-wsl-logs.ps1</S> <S N="Line">Get-WindowsOptionalFeature -Online > $folder/optional-components.txt_x000A_</S> <S N="Statement">Get-WindowsOptionalFeature -Online > $folder/optional-components.txt</S> <S N="PositionMessage">At C:\Users\rokej\collect-wsl-logs.ps1:57 char:1_x000D__x000A_+ Get-WindowsOptionalFeature -Online > $folder/optional-components.txt_x000D__x000A_+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</S> <S N="PSScriptRoot">C:\Users\rokej</S> <S N="PSCommandPath">C:\Users\rokej\collect-wsl-logs.ps1</S> <S N="InvocationName">Get-WindowsOptionalFeature</S> <I32 N="PipelineLength">0</I32> <I32 N="PipelinePosition">0</I32> <B N="ExpectingInput">false</B> <Obj N="CommandOrigin" RefId="10"> <TN RefId="10"> <T>System.Management.Automation.CommandOrigin</T> <T>System.Enum</T> <T>System.ValueType</T> <T>System.Object</T> </TN> <ToString>Internal</ToString> <I32>1</I32> </Obj> <Nil N="DisplayScriptPosition" /> </Props> </Obj> <I32 N="ErrorCategory_Category">0</I32> <S N="ErrorCategory_Activity">Get-WindowsOptionalFeature</S> <S N="ErrorCategory_Reason">COMException</S> <S N="ErrorCategory_TargetName"></S> <S N="ErrorCategory_TargetType"></S> <S N="ErrorCategory_Message">NotSpecified: (:) [Get-WindowsOptionalFeature], COMException</S> <B N="SerializeExtendedInfo">false</B> <S N="ErrorDetails_ScriptStackTrace">at <ScriptBlock>, C:\Users\rokej\collect-wsl-logs.ps1: line 57_x000D__x000A_at <ScriptBlock>, <No file>: line 1</S> </MS> </Obj> </Objs>
Metadata
Metadata
Assignees
Labels
No labels

Activity
github-actions commentedon Jul 4, 2025
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here
Once completed please upload the output files to this Github issue.
Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.
beedell-roke commentedon Jul 4, 2025
Triage assignee, please prevent this bot activating on this report.
zcobol commentedon Jul 5, 2025
@RokeJulianLockhart are you trying to run the scrip from within WSL? If you run it as Administrator on Windows side there are no issues:
beedell-roke commentedon Jul 5, 2025
Toto (@zcobol), no. I realise that PowerShell Core supports Linux, but I was under the impression that this script is designed to be invoked on the host Windows installation. Should it be?
Considering you've a preprocessor statement at
L1, I can't imagine that it's possible to invoke otherwise. It certainly doesn't appear to be possible, when I attempt to invoke it outside of Administrator mode:Details
Irrespective, when I invoke it in a shell spawned from an administrative instance of
wt, 1 the same error occurs:Footnotes
github.com/PowerShell/PowerShell/discussions/25729#discussioncomment-13671569↩beedell-roke commentedon Aug 7, 2025
Perhaps, this is a failure of PowerShell, per
PowerShell/issues/25835.OneBlue commentedon Oct 17, 2025
Hmm that's interesting. I've never seen that before. It's looking like the optional component logic causing this.
What's the output of
Get-WindowsOptionalFeature -Online?OneBlue commentedon Oct 17, 2025
Actually looks like this is tracked from powershell PowerShell/PowerShell#25835. Closing since the issue isn't coming from WSL
beedell-roke commentedon Oct 17, 2025
Blue (@OneBlue), thanks. However, this isn't a downstream duplicate; I left this problem open because whilst upstream's problem remains, the WSL team should modify the affected script to not invoke via PowerShell Core, or, better yet, return an error message that it needs to be invoked on Windows PowerShell, if those modules fail with that error.
I'll re-scope this issue if you agree.
Otherwise, please re-close as a duplicate, rather than as completed; it provides a better indicator of severity at the linked upstream issue.