Sysprep - ExtendOSPartition - 无人参与

Sysprep - ExtendOSPartition - 无人参与

此刻我正在跑步:

Sysprep.exe /generalize /oobe /quit /mode:vm /quiet

效果很好。

我现在正在尝试添加/无人参与能够包含配置扩展操作系统分区

我现在拥有的是以下 unattend.xml 文件:

<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="generalize">
        <component name="Microsoft-Windows-PnpSysprep" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <Generalize>
                <Mode>OOBE</Mode>
            </Generalize>
            <ExtendOSPartition>
                <Extend>true</Extend>
            </ExtendOSPartition>
        </component>
    </settings>
</unattend>

然后我尝试运行 sysprep

Sysprep.exe /generalize /oobe /quit /mode:vm /unattend:"C:\post-generation\unattend.xml" /quiet

我尝试了 unattend.xml 文件的各种配置,但似乎都不起作用。当前的 unattend.xml 出现以下错误:

2024-04-10 15:59:09, Info                         [Sysprep.exe] UnattendFindAnswerFile: Looking at explicitly provided unattend file [C:\post-generation\unattend.xml]...
2024-04-10 15:59:09, Info                         [Sysprep.exe] UnattendFindAnswerFile: [C:\post-generation\unattend.xml] meets criteria for an explicitly provided unattend file.
2024-04-10 15:59:09, Info                  SYSPRP SysprepSearchForUnattend: Using unattend file at [C:\post-generation\unattend.xml].
2024-04-10 15:59:09, Warning               SYSPRP SysprepSearchForUnattend: Unattend file [C:\post-generation\unattend.xml] contains invalid [generalize] pass; hrResult = 0x80220003
2024-04-10 15:59:09, Warning               SYSPRP WinMain:Encountered invalid unattend file during search; hrResult = 0x80220003
2024-04-10 15:59:09, Info                  IBS    UnattendErrorFromResults: Hit an unattend error; dumping any info we have about the failure...
2024-04-10 15:59:09, Info                  IBS    UnattendDumpSetting: ------Unattend setting error / warning------
2024-04-10 15:59:09, Info                  IBS    UnattendDumpSetting: Error code = 0x80220003
2024-04-10 15:59:09, Info                  IBS    UnattendDumpSetting: Pass = generalize
2024-04-10 15:59:09, Info                  IBS    UnattendDumpSetting: --------------------------------------------
2024-04-10 15:59:09, Info                  IBS    UnattendErrorFromResults: Error text = Windows could not parse or process the unattend answer file for pass [generalize]. The answer file is invalid.

我想要实现的结果与我运行此命令时的结果完全相同:

Sysprep.exe /generalize /oobe /quit /mode:vm /quiet

但我还希望它在第一次启动时扩展操作系统分区。

我以前从未使用过或配置过 unattend.xml 文件,因此如果我缺少基本的内容,我深感抱歉。

更新

现在我也尝试过这个:

<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
            <ExtendOSPartition>true</ExtendOSPartition>
        </component>
    </settings>
</unattend>

写道图像状态_不可部署到:HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State

它还将其写入setuperr.log:

2024-03-02 18:24:32, Error                 SYSPRP MRTGeneralize:98 - ERROR: Failed ConnectServer
2024-03-02 18:24:34, Error                 SYSPRP BCD: BiUpdateEfiEntry failed c000000d
2024-03-02 18:24:34, Error                 SYSPRP BCD: BiExportBcdObjects failed c000000d
2024-03-02 18:24:34, Error                 SYSPRP BCD: BiExportStoreAlterationsToEfi failed c000000d
2024-03-02 18:24:34, Error                 SYSPRP BCD: Failed to export alterations to firmware. Status: c000000d

并且似乎损坏了虚拟机,因为我无法再定期连接到它(通过串行控制台获取日志)。

答案1

这确实起到了作用并且满足了我的需求:

无人参与.xml:

<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="specialize">
        <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
            xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <ExtendOSPartition>
                <Extend>true</Extend>
            </ExtendOSPartition>
        </component>
    </settings>
</unattend>

sysprep 命令行:

Sysprep.exe /generalize /oobe /quit /mode:vm /unattend:"C:\unattend.xml" /quiet

相关内容