我想通过另一台电脑修复硬盘上安装的损坏的 Windows。我用作修复源的 wim 文件是从另一个包含多个 Windows 版本的 wim 文件中提取的,而我实际上提取的 Windows 版本与损坏的 Windows 版本相匹配。我在 DISM 命令的日志文件中收到以下消息,我想知道它是什么意思?它是指损坏的文件系统吗?我应该如何修复此错误?
使用的命令:
Dism /image:G:\ /Cleanup-Image /RestoreHealth /Source:H:\install.wim /LimitAccess /Logpath:H:\dism.log
错误信息:
Warning CBS The alternate source path directory could not be accessed [HRESULT = 0x8007007b - ERROR_INVALID_NAME]
答案1
命令结构是不正确- 更正命令来修复组件存储Windows\WinSxS
脱机 Windows 映像的[ ]:
- 无需从多索引 ESD/WIM 中导出 WIM,因为无论如何都必须指定索引号
- 这样做产生的问题比它解决的问题还多,因为
install.esd
由于它的压缩率比 WIM 高 33%,所以总是 <4GB,而总是install.wim
>4GB(对于格式化为 FAT32 的 EFI 可启动安装 USB 来说,这是一个问题)
- 这样做产生的问题比它解决的问题还多,因为
- 通过以下方式确定 ESD/WIM 索引号和版本/构建信息
/Get-ImageInfo
:# Default install.<esd|wim> index numbers - Home: 1 | Pro: 6 Dism /Get-ImageInfo /ImageFile:"H:\install.<esd|wim>" # Verify version and build information: Dism /Get-ImageInfo /ImageFile:"H:\install.<esd|wim>" /Index:#
PS $ Dism /Get-ImageInfo /ImageFile:"E:\sources\install.esd" Deployment Image Servicing and Management tool Version: 10.0.22621.2792 Details for image : E:\sources\install.esd Index : 1 Name : Windows 11 Home Description : Windows 11 Home Size : 16,168,829,996 bytes Index : 2 Name : Windows 11 Home N Description : Windows 11 Home N Size : 15,506,889,019 bytes Index : 3 Name : Windows 11 Home Single Language Description : Windows 11 Home Single Language Size : 16,153,401,297 bytes Index : 4 Name : Windows 11 Education Description : Windows 11 Education Size : 16,463,631,301 bytes Index : 5 Name : Windows 11 Education N Description : Windows 11 Education N Size : 15,808,633,936 bytes Index : 6 Name : Windows 11 Pro Description : Windows 11 Pro Size : 16,479,089,353 bytes Index : 7 Name : Windows 11 Pro N Description : Windows 11 Pro N Size : 15,810,170,147 bytes PS $ Dism /Get-ImageInfo /ImageFile:"E:\sources\install.esd" /Index:1 Deployment Image Servicing and Management tool Version: 10.0.22621.2792 Details for image : E:\sources\install.esd Index : 1 Name : Windows 11 Home Description : Windows 11 Home Size : 16,168,829,996 bytes WIM Bootable : No Architecture : x64 Hal : <undefined> Version : 10.0.22621 ServicePack Build : 525 ServicePack Level : 0 Edition : Core Installation : Client ProductType : WinNT ProductSuite : Terminal Server System Root : WINDOWS Directories : 22687 Files : 102254 Created : 2022.09.24 - 20:47:30 Modified : 2022.11.11 - 07:04:21 Languages : en-US (Default) PS $ Dism /Get-ImageInfo /ImageFile:"E:\sources\install.esd" /Index:6 Deployment Image Servicing and Management tool Version: 10.0.22621.2792 Details for image : E:\sources\install.esd Index : 6 Name : Windows 11 Pro Description : Windows 11 Pro Size : 16,479,089,353 bytes WIM Bootable : No Architecture : x64 Hal : <undefined> Version : 10.0.22621 ServicePack Build : 525 ServicePack Level : 0 Edition : Professional Installation : Client ProductType : WinNT ProductSuite : Terminal Server System Root : WINDOWS Directories : 22867 Files : 103384 Created : 2022.09.24 - 20:47:30 Modified : 2022.11.11 - 07:04:29 Languages : en-US (Default)
/Cleanup-Image
具有层次顺序,因此首先运行/StartComponentCleanup
到干净的任何损坏的组件商店硬链接,然后运行/RestoreHealth
:# Clean the offline image's Component Store: Dism /Image:"G:\Windows" /Cleanup-Image /StartComponentCleanup # Specify the index number at the end of the /Source parameter: # ESD: Dism /Image:"G:\Windows" /Cleanup-Image /RestoreHealth /Source:esd:"H:\install.esd":1 /LimitAccess /Logpath:"H:\dism.log" # WIM: Dism /Image:"G:\Windows" /Cleanup-Image /RestoreHealth /Source:wim:"H:\install.wim":1 /LimitAccess /Logpath:"H:\dism.log"
- 虽然 OP 在问题中提到了这一点,但
/Source
必须与正在修复的脱机 Windows 映像的精确版本 [23H2、24H1 等] 匹配(我不确定构建版本是否也必须匹配)
- 虽然 OP 在问题中提到了这一点,但
- 一旦
/Cleanup-Image
成功完成组件库的修复,Sfc /ScanNow
还必须针对脱机映像运行以修复操作系统文件(/Cleanup-Image
并且/ScanNow
密不可分链接):
(通过日志语法在VS 代码)# Repair offline Windows image OS files: Sfc /ScanNow /OffBootDir=G:\ /OffWinDir=G:\Windows /OffLogFile=H:\sfc.log # Export repair details to seperate log for efficient viewing: FindStr /c:"[SR]" "H:\sfc.log" > "H:\SFCdetails.log"