我正在尝试为Windows Server 2016无人参与安装创建unattended.xml文件,其中在安装Windows后,它应该执行位于远程samba共享上的一个powershell脚本。
我使用以下命令来运行存储在samba共享中的powershell脚本:
cmd.exe /c "ECHO R | powershell.exe -ExecutionPolicy Unrestricted -File \\192.168.137.131\install\ConfigureRemotingForAnsible.ps1"
无人参与安装过程运行良好,但ConfigureRemotingForAnsible.ps1脚本执行失败,并显示错误:
The argument '\\192.168.137.131\install\ConfigureRemotingForAnsible.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.
手动运行时,相同的命令会成功执行。
unattended.xml文件的相关部分:
<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">
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<Path>cmd.exe /c "ECHO R | powershell.exe -ExecutionPolicy Unrestricted -File \\192.168.137.131\install\ConfigureRemotingForAnsible.ps1"</Path>
</RunSynchronousCommand>
</RunSynchronous>
</component>
</settings>
有人可以告诉我应该在我的unattended.xml中添加什么才能使其正常工作?
提前致谢。