原始 Windows 11 安装程序 ISO 经过修改,可在受限资源设置下运行,因此已完全删除大多数 Windows 组件、软件包或功能的痕迹,以最小化最终安装的大小。并且此修改后的 ISO 用于在当前系统上安装。这样即使运行也Dism /online /Get-Features
不会列出该功能。
安装原始(未修改)官方完整 Windows 11 ISO 映像:
PS C:\> Dism /Mount-Image /ImageFile:E:\Sources\install.wim /Index:7 /MountDir:C:\test\offline /Readonly
Deployment Image Servicing and Management tool
Version: 10.0.22621.1
Mounting image
[==========================100.0%==========================]
The operation completed successfully.
原始 ISO 具有以下特点:
PS C:\> Dism /Image:C:\test\offline /Get-FeatureInfo /FeatureName:Microsoft-Windows-Subsystem-Linux
Deployment Image Servicing and Management tool
Version: 10.0.22621.1
Image Version: 10.0.22621.525
Feature Information:
Feature Name : Microsoft-Windows-Subsystem-Linux
Display Name : Windows Subsystem for Linux
Description : Provides services and environments for running native user-mode Linux shells and tools on Windows.
Restart Required : Possible
State : Disabled
Custom Properties:
ServerComponent\Description : Provides services and environments for running native user-mode Linux shells and tools on Windows.
ServerComponent\DisplayName : Windows Subsystem for Linux
ServerComponent\Id : 1033
ServerComponent\Type : Feature
ServerComponent\UniqueName : Microsoft-Windows-Subsystem-Linux
ServerComponent\Deploys\Update\Name : Microsoft-Windows-Subsystem-Linux
The operation completed successfully.
该功能已完全删除(在修改后的 ISO 安装程序上),因此在已安装的 Windows 上无法识别该功能:
PS C:\> Dism /Online /Get-FeatureInfo /FeatureName:Microsoft-Windows-Subsystem-Linux
Deployment Image Servicing and Management tool
Version: 10.0.22621.1
Image Version: 10.0.22621.1245
Error: 0x800f080c
Feature name Microsoft-Windows-Subsystem-Linux is unknown.
A Windows feature name was not recognized.
Use the /Get-Features option to find the name of the feature in the image and try the command again.
The DISM log file can be found at C:\Windows\Logs\DISM\dism.log
无法安装该功能,因为它无法被识别(尽管存在于/Source上):
PS C:\> Dism /Online /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /Source:C:\test\offline\Windows\WinSxS\ /All /LimitAccess
Deployment Image Servicing and Management tool
Version: 10.0.22621.1
Image Version: 10.0.22621.1245
Error: 0x800f080c
Feature name Microsoft-Windows-Subsystem-Linux is unknown.
A Windows feature name was not recognized.
Use the /Get-Features option to find the name of the feature in the image and try the command again.
The DISM log file can be found at C:\Windows\Logs\DISM\dism.log
使用了 DISM,但解决方案不必使用 DISM。此外,如果每个可选功能都有独立的安装程序,这将是一个有效的解决方案。现在,如何在不执行完整操作系统安装的情况下启用此类功能(及其依赖项)?
日志文件(C:\Windows\Logs\Dism\dism.log)仅适用于最后一个命令:
2023-02-07 02:52:29, Info DISM PID=20420 TID=20424 Scratch directory set to 'C:\Users\Admin\AppData\Local\Temp\'. - CDISMManager::put_ScratchDir
2023-02-07 02:52:29, Info DISM PID=20420 TID=20424 DismCore.dll version: 10.0.22621.1 - CDISMManager::FinalConstruct
2023-02-07 02:52:29, Info DISM Initialized Panther logging at C:\Windows\Logs\DISM\dism.log
2023-02-07 02:52:29, Info DISM PID=20420 TID=20424 Successfully loaded the ImageSession at "C:\Windows\system32\Dism" - CDISMManager::LoadLocalImageSession
2023-02-07 02:52:29, Info DISM Initialized Panther logging at C:\Windows\Logs\DISM\dism.log
2023-02-07 02:52:29, Info DISM DISM Provider Store: PID=20420 TID=20424 Found and Initialized the DISM Logger. - CDISMProviderStore::Internal_InitializeLogger
2023-02-07 02:52:29, Info DISM Initialized Panther logging at C:\Windows\Logs\DISM\dism.log
2023-02-07 02:52:29, Info DISM DISM Manager: PID=20420 TID=20424 Successfully created the local image session and provider store. - CDISMManager::CreateLocalImageSession
2023-02-07 02:52:29, Info DISM DISM.EXE:
2023-02-07 02:52:29, Info DISM DISM.EXE: <----- Starting Dism.exe session ----->
2023-02-07 02:52:29, Info DISM DISM.EXE:
2023-02-07 02:52:29, Info DISM DISM.EXE: Host machine information: OS Version=10.0.22621, Running architecture=amd64, Number of processors=2
2023-02-07 02:52:29, Info DISM DISM.EXE: Dism.exe version: 10.0.22621.1
2023-02-07 02:52:29, Info DISM DISM.EXE: Executing command line: "C:\Windows\system32\Dism.exe" /Online /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /Source:C:\test\offline\Windows\WinSxS\ /All /LimitAccess
2023-02-07 02:52:29, Info DISM DISM Manager: PID=20420 TID=20424 physical location path: C:\ - CDISMManager::CreateImageSession
2023-02-07 02:52:29, Info DISM DISM Manager: PID=20420 TID=20424 Event name for current DISM session is Global\{3215538E-EA92-474F-A021-31BC279C7964} - CDISMManager::CheckSessionAndLock
2023-02-07 02:52:29, Info DISM DISM Manager: PID=20420 TID=20424 Create session event 0x248 for current DISM session and event name is Global\{3215538E-EA92-474F-A021-31BC279C7964} - CDISMManager::CheckSessionAndLock
2023-02-07 02:52:29, Info DISM DISM Manager: PID=20420 TID=20424 Copying DISM from "C:\Windows\System32\Dism" - CDISMManager::CreateImageSessionFromLocation
2023-02-07 02:52:29, Info DISM DISM Manager: PID=20420 TID=20424 No Sandbox was created, DISM running in-place. - CDISMManager::CreateImageSessionFromLocation
2023-02-07 02:52:29, Info DISM DISM Manager: PID=20420 TID=20424 Successfully loaded the ImageSession at "C:\Windows\System32\Dism" - CDISMManager::LoadRemoteImageSession
2023-02-07 02:52:29, Info DISM DISM Image Session: PID=20448 TID=20468 Instantiating the Provider Store. - CDISMImageSession::get_ProviderStore
2023-02-07 02:52:29, Info DISM DISM OS Provider: PID=20448 TID=20468 Defaulting SystemPath to C:\ - CDISMOSServiceManager::Final_OnConnect
2023-02-07 02:52:29, Info DISM DISM OS Provider: PID=20448 TID=20468 Defaulting Windows folder to C:\Windows - CDISMOSServiceManager::Final_OnConnect
2023-02-07 02:52:29, Info DISM DISM Provider Store: PID=20448 TID=20468 Attempting to initialize the logger from the Image Session. - CDISMProviderStore::Final_OnConnect
2023-02-07 02:52:29, Info DISM Initialized Panther logging at C:\Windows\Logs\DISM\dism.log
2023-02-07 02:52:29, Info DISM DISM Provider Store: PID=20448 TID=20468 Found and Initialized the DISM Logger. - CDISMProviderStore::Internal_InitializeLogger
2023-02-07 02:52:29, Info DISM Initialized Panther logging at C:\Windows\Logs\DISM\dism.log
2023-02-07 02:52:29, Info DISM Initialized Panther logging at C:\Windows\Logs\DISM\dism.log
2023-02-07 02:52:29, Info DISM DISM Manager: PID=20420 TID=20424 Image session successfully loaded from location: C:\Windows\System32\Dism - CDISMManager::CreateImageSession
2023-02-07 02:52:29, Info DISM DISM.EXE: Target image information: OS Version=10.0.22621.1245, Image architecture=amd64
2023-02-07 02:52:29, Info DISM DISM.EXE: Image session version: 10.0.22621.1
2023-02-07 02:52:29, Info DISM DISM Transmog Provider: PID=20448 TID=20468 Current image session is [ONLINE] - CTransmogManager::GetMode
2023-02-07 02:52:29, Info DISM DISM Transmog Provider: PID=20448 TID=20468 Audit Mode: [No] - CTransmogManager::Initialize
2023-02-07 02:52:29, Info DISM DISM Transmog Provider: PID=20448 TID=20468 GetProductType: ProductType = [WinNT] - CTransmogManager::GetProductType
2023-02-07 02:52:29, Info DISM DISM Transmog Provider: PID=20448 TID=20468 Product Type: [WinNT] - CTransmogManager::Initialize
2023-02-07 02:52:29, Info DISM DISM Transmog Provider: PID=20448 TID=20468 Product Type ServerNT : [No] - CTransmogManager::Initialize
2023-02-07 02:52:29, Info CSI 00000001 Shim considered [l:126]'\??\C:\Windows\Servicing\amd64_microsoft-windows-servicingstack_31bf3856ad364e35_10.0.22621.1245_none_e95e4cae42cdfd26\wcp.dll' : got STATUS_OBJECT_PATH_NOT_FOUND
2023-02-07 02:52:29, Info CSI 00000002 Shim considered [l:123]'\??\C:\Windows\WinSxS\amd64_microsoft-windows-servicingstack_31bf3856ad364e35_10.0.22621.1245_none_e95e4cae42cdfd26\wcp.dll' : got STATUS_SUCCESS
2023-02-07 02:52:29, Info DISM DISM Driver Manager: PID=20448 TID=20468 Further logs for driver related operations can be found in the target operating system at %WINDIR%\inf\setupapi.offline.log - CDriverManager::Initialize
2023-02-07 02:52:29, Info DISM DISM Package Manager: PID=20448 TID=20468 Finished initializing the CbsConUI Handler. - CCbsConUIHandler::Initialize
2023-02-07 02:52:29, Info DISM DISM Package Manager: PID=20448 TID=20468 CBS is being initialized for online use. More information about CBS actions can be located at: %windir%\logs\CBS\CBS.log - CDISMPackageManager::Initialize
2023-02-07 02:52:29, Info DISM DISM Package Manager: PID=20448 TID=20468 Loaded servicing stack for online use. - CDISMPackageManager::CreateCbsSession
2023-02-07 02:52:29, Info CSI 00000001 Shim considered [l:126]'\??\C:\Windows\Servicing\amd64_microsoft-windows-servicingstack_31bf3856ad364e35_10.0.22621.1245_none_e95e4cae42cdfd26\wcp.dll' : got STATUS_OBJECT_PATH_NOT_FOUND
2023-02-07 02:52:29, Info CSI 00000002 Shim considered [l:123]'\??\C:\Windows\WinSxS\amd64_microsoft-windows-servicingstack_31bf3856ad364e35_10.0.22621.1245_none_e95e4cae42cdfd26\wcp.dll' : got STATUS_SUCCESS
2023-02-07 02:52:29, Info DISM DISM Package Manager: PID=20448 TID=20468 Processing the top level command token(enable-feature). - CPackageManagerCLIHandler::Private_ValidateCmdLine
2023-02-07 02:52:29, Info DISM DISM Package Manager: PID=20448 TID=20468 Attempting to route to appropriate command handler. - CPackageManagerCLIHandler::ExecuteCmdLine
2023-02-07 02:52:29, Info DISM DISM Package Manager: PID=20448 TID=20468 Routing the command... - CPackageManagerCLIHandler::ExecuteCmdLine
2023-02-07 02:52:29, Info DISM DISM Package Manager: PID=20448 TID=20468 Encountered the option "featurename" with value "Microsoft-Windows-Subsystem-Linux" - CPackageManagerCLIHandler::Private_GetPackagesFromCommandLine
2023-02-07 02:52:29, Info DISM DISM Package Manager: PID=20448 TID=20468 Encountered an unknown option "featurename" with value "Microsoft-Windows-Subsystem-Linux" - CPackageManagerCLIHandler::Private_GetPackagesFromCommandLine
2023-02-07 02:52:29, Info DISM DISM Package Manager: PID=20448 TID=20468 Encountered the option "source" with value "C:\test\offline\Windows\WinSxS\" - CPackageManagerCLIHandler::Private_GetPackagesFromCommandLine
2023-02-07 02:52:29, Info DISM DISM Package Manager: PID=20448 TID=20468 Encountered an unknown option "source" with value "C:\test\offline\Windows\WinSxS\" - CPackageManagerCLIHandler::Private_GetPackagesFromCommandLine
2023-02-07 02:52:29, Error DISM DISM Package Manager: PID=20448 TID=20468 Failed to get the Update through CBS. - CDISMPackage::Internal_OpenFeature(hr:0x800f080c)
2023-02-07 02:52:29, Error DISM DISM Package Manager: PID=20448 TID=20468 Failed to get the underlying CBS Feature - CDISMPackage::OpenFeature(hr:0x800f080c)
2023-02-07 02:52:29, Error DISM DISM Package Manager: PID=20448 Feature name Microsoft-Windows-Subsystem-Linux is unknown. - CPackageManagerCLIHandler::Private_GetFeaturesFromCommandLine(hr:0x800f080c)
2023-02-07 02:52:29, Error DISM DISM Package Manager: PID=20448 TID=20468 Unknown features were specified on the command-line. - CPackageManagerCLIHandler::Private_GetFeaturesFromCommandLine(hr:0x800f080c)
2023-02-07 02:52:29, Error DISM DISM Package Manager: PID=20448 TID=20468 Failed to get the Feature List from the command line. - CPackageManagerCLIHandler::Private_ProcessFeatureChange(hr:0x800f080c)
2023-02-07 02:52:29, Error DISM DISM Package Manager: PID=20448 TID=20468 Failed while processing command enable-feature. - CPackageManagerCLIHandler::ExecuteCmdLine(hr:0x800f080c)
2023-02-07 02:52:29, Info DISM DISM Package Manager: PID=20448 TID=20468 Further logs for online package and feature related operations can be found at %WINDIR%\logs\CBS\cbs.log - CPackageManagerCLIHandler::ExecuteCmdLine
2023-02-07 02:52:29, Info DISM DISM Package Manager: PID=20448 TID=20468 Finalizing CBS core. - CDISMPackageManager::Finalize
2023-02-07 02:52:29, Info DISM DISM Manager: PID=20420 TID=20424 Closing session event handle 0x248 - CDISMManager::CleanupImageSessionEntry
2023-02-07 02:52:29, Info DISM DISM.EXE: Image session has been closed. Reboot required=no.
2023-02-07 02:52:29, Info DISM DISM.EXE:
2023-02-07 02:52:29, Info DISM DISM.EXE: <----- Ending Dism.exe session ----->
2023-02-07 02:52:29, Info DISM DISM.EXE: