在 Eclipse WTP 中创建“WindowsUpdateDiagnostic.diagcab”的应答文件

sem*_*x41 5 windows windows-7 troubleshooting platform answerfile

WindowsUpdateDiagnostic.diagcab 我正在尝试编写此处来源的安装脚本。

msdt.exe /cab "%~dp0WindowsUpdateDiagnostic.diagcab" -af "%~dp0stillneeded.xml"
Run Code Online (Sandbox Code Playgroud)

不幸的是,创建应答文件的尝试似乎失败了:

在此输入图像描述

在 0x80092003 上没有找到太多信息。我希望通过一个示例answers.xml,我可以欺骗答案并使其正常工作。

这是一个模板,但我没有任何运气。

<Answers>

  <Interaction ID="IT_Theme">

  <Value>Nature</Value>

  </Interaction>

</Answers>
Run Code Online (Sandbox Code Playgroud)

来源:https ://msdn.microsoft.com/en-us/library/dd776530.aspx#CommandLineAdministration

提前致谢。

小智 4

您可以在 PowerShell 中使用 Get-TroubleshootingPack ( https://msdn.microsoft.com/en-us/library/dd323716(v=vs.85).aspx ) cmdlet 创建应答文件:

\n\n
Get-TroubleshootingPack\xe2\x80\x84C:\\Windows\\Diagnostics\\system\\WindowsUpdate\xe2\x80\x84-AnswerFile\xe2\x80\x84c:\\WUDAnswers.xml\n
Run Code Online (Sandbox Code Playgroud)\n\n

(请注意,它使用 %systemroot% 中现有疑难解答程序的路径(通常为 C:\\Windows),而不是 .diagcab 文件。我无法使用 .diagcab 文件创建应答文件)。

\n\n

这应该只问您一个问题,然后您输入“1 [Enter]”来回答“Apply Fix”。然后您可以创建一个 PowerShell 脚本 (.ps1),其中仅包含以下行:

\n\n
Get-TroubleshootingPack -Path C:\\Windows\\diagnostics\\system\\WindowsUpdate | Invoke-TroubleshootingPack -AnswerFile c:\\WUDAnswers.xml -Unattended -Result c:\\WUDResult\n
Run Code Online (Sandbox Code Playgroud)\n\n

您可以使用如下命令运行该 PowerShell 脚本:

\n\n
powershell -ExecutionPolicy Bypass -file c:\\RunWindowsUpdateDiagnostics.ps1\n
Run Code Online (Sandbox Code Playgroud)\n\n

...这应该在 C:\\WUDResult 中创建 3 个或更多文件(根据需要更改路径)。

\n