在 unattend.xml 中放置 powershell 脚本的位置

Where to place powershell script in unattend.xml

我目前在 unattend.xml 文件中 运行 宁 powershell 脚本时遇到问题。 powershell 应该安装应用程序,但 xml 文件似乎无法 运行 脚本行。

我在使用 <FirstLogonCommands><RunSynchronousCommand><SynchronousCommand>

之间来回切换
<FirstLogonCommands>
   <SynchronousCommand wcm:action="add">
    <CommandLine>Powershell -ExecutionPolicy ByPass -File \deploy\RemoteInstall\WdsClientUnattend\deploySoftware.ps1</CommandLine>
    <Description>Installs software</Description>
    <Order>1</Order>
   </SynchronousCommand>
</FirstLogonCommands>

这个命令是 运行 从我们的服务器安装应用程序的 ps1 脚本。

我不确定问题出在哪里,但是如果不需要在 autounattend.xml 文件中包含命令,我建议您尝试将命令放在 \sources \$OEM$\$$\Setup\Scripts\SetupComplete.cmd 文件.

先用powershell命令制作cmd文件,像这样

PowerShell.exe /W Normal -ExecutionPolicy Bypass ...

然后通过运行手动测试它是否正常工作。如果是,请将其放入上述目录并尝试重新安装 windows。