将Powershell脚本放在unattend.xml中的位置

时间:2019-07-03 16:56:41

标签: xml powershell scripting windows-10 unattend-file

我目前在我拥有的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脚本,该脚本可从我们的服务器安装应用程序。

1 个答案:

答案 0 :(得分:0)

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

首先使用powershell命令制作cmd文件,如下所示

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

然后通过手动运行它来测试它是否正常工作。如果是这样,请将其放在上述目录中,然后尝试再次安装Windows。