我正在通过USB构建win10机器,但是当它第一次引导到桌面时,只会运行第一个脚本(弹出通知),这是我的Unattend.xml
的摘要:>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Description>Pop out nOtification</Description>
<Order>1</Order>
<CommandLine>powershell Add-Type -AssemblyName PresentationFramework; [System.Windows.MessageBox]::Show('Make sure the computer is connected to the unauth port before continuing!!')</CommandLine>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Description>Rename and Join Computer to Domain</Description>
<Order>2</Order>
<CommandLine>powershell Add-Type -AssemblyName Microsoft.VisualBasic; $COMPNAME = [Microsoft.VisualBasic.Interaction]::InputBox('Enter New Name', 'Rename Computer'); $OLDNAME = hostname; $CRED = Get-Credential -Message 'Enter admin credential'; $OUPATH = 'OU=Windows10,OU=LTCP User Computers,DC=domainhere,DC=com'; write-host ' after a restart'"`n"; Add-Computer -DomainName "domain.com" -ComputerName $OLDNAME -NewName $COMPNAME -Credential $CRED -OUPath $OUPATH; write-host "`n"'Join sucessful, machine is in WIN10 OU.. restarting in 10s' -ForegroundColor Yellow; Start-Sleep 10; Restart-Computer</CommandLine>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
</FirstLogonCommands>
我已验证脚本在PowerShell ISE中可以正常运行,任何人都知道为什么会发生这种情况吗?