运行c:\windows\system32\sysprep\sysprep -oobe -reboot时得到下面错误信息:
依照提示打开c:\windows\system32\sysprep\panther\setupact.log查看,当前Windows版本中这个问题有权限保护,需要复制到其它目录或者更改用户权限后可读。看到最新的部分是这样的:
2022-03-09 09:54:41, Info SYSPRP ========================================================
2022-03-09 09:54:41, Info SYSPRP === Beginning of a new sysprep run ===
2022-03-09 09:54:41, Info SYSPRP ========================================================
2022-03-09 09:54:41, Info [0x0f004d] SYSPRP The time is now 2022-03-09 09:54:41
2022-03-09 09:54:41, Info [0x0f004e] SYSPRP Initialized SysPrep log at C:\Windows\System32\Sysprep\Panther
2022-03-09 09:54:41, Info [0x0f0054] SYSPRP ValidatePrivileges:User has required privileges to sysprep machine
2022-03-09 09:54:41, Info [0x0f007c] SYSPRP FCreateTagFile:Successfully deleted tag file C:\Windows\System32\Sysprep\Sysprep_succeeded.tag
2022-03-09 09:54:41, Warning SYSPRP WinMain: File operations pending
2022-03-09 09:54:41, Info [0x0f005f] SYSPRP ParseCommands:Found supported command line option ‘OOBE’
2022-03-09 09:54:41, Info [0x0f005f] SYSPRP ParseCommands:Found supported command line option ‘REBOOT’
2022-03-09 09:54:41, Info [0x0f00d7] SYSPRP WinMain:Pre-validing ‘cleanup’ internal providers.
2022-03-09 09:54:41, Info SYSPRP RunDlls:Running platform actions specified in action file for phase 3
2022-03-09 09:54:41, Info SYSPRP SysprepSession::CreateSession: Successfully created instance with action file C:\Windows\System32\Sysprep\ActionFiles\Cleanup.xml, and mode
2022-03-09 09:54:41, Info SYSPRP SysprepSession::Validate: Beginning action execution from C:\Windows\System32\Sysprep\ActionFiles\Cleanup.xml
2022-03-09 09:54:41, Info SYSPRP SysprepSession::CreateXPathForSelection: Sysprep mode in registry is
2022-03-09 09:54:41, Info SYSPRP SysprepSession::CreateXPathForSelection: Processor architecture in registry is AMD64
2022-03-09 09:54:41, Info SYSPRP ActionPlatform::LaunchModule: Executing method ‘Sysprep_Clean_Validate_Opk’ from C:\Windows\System32\spopk.dll
2022-03-09 09:54:41, Info CSI 00000001 Shim considered [l:125]’\??\C:\windows\Servicing\amd64_microsoft-windows-servicingstack_31bf3856ad364e35_10.0.22000.469_none_04a25ac34c904574\wcp.dll’ : got STATUS_OBJECT_PATH_NOT_FOUND
2022-03-09 09:54:41, Info CSI 00000002 Shim considered [l:122]’\??\C:\windows\WinSxS\amd64_microsoft-windows-servicingstack_31bf3856ad364e35_10.0.22000.469_none_04a25ac34c904574\wcp.dll’ : got STATUS_SUCCESS
2022-03-09 09:54:41, Error SYSPRP Sysprep_Clean_Validate_Opk: Audit mode cannot be turned on if reserved storage is in use. An update or servicing operation may be using reserved storage.; hr = 0x800F0975
2022-03-09 09:54:41, Error SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing ‘Sysprep_Clean_Validate_Opk’ from C:\Windows\System32\spopk.dll; dwRet = 0x975
2022-03-09 09:54:41, Error SYSPRP SysprepSession::Validate: Error in validating actions from C:\Windows\System32\Sysprep\ActionFiles\Cleanup.xml; dwRet = 0x975
2022-03-09 09:54:41, Error SYSPRP RunPlatformActions:Failed while validating Sysprep session actions; dwRet = 0x975
2022-03-09 09:54:41, Error [0x0f0070] SYSPRP RunDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x975
2022-03-09 09:54:41, Error [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep cleanup internal providers; hr = 0x80070975
2022-03-09 09:54:54, Info [0x0f0052] SYSPRP Shutting down SysPrep log
2022-03-09 09:54:54, Info [0x0f004d] SYSPRP The time is now 2022-03-09 09:54:54
显然关键的信息是这个An update or servicing operation may be using reserved storage.; hr = 0x800F0975
于是怀疑有部分Windows升级没有被安装完成。于是重启电脑,希望等待重启的升级安装能够安装完成。但是结果是无效,sysprep仍然报相同的问题。仔细思考后,认为仍然是Windows升级导致的。于是查看设置中的Windows Update项目。
看到有3个项目等待升级,并且需要手工点“Install now”。于是点“Install now”按钮安装这3个项目。安装完成后仍然需要一个重启。
再次重启后,使用Sysprep仍然遇到相同问题,查看Windows Update页面所有安装已经完成。于是又重启一次电脑。这一次重启后,再运行System -oobe -reboot成功。