[英]Continue powershell script execution even if a reboot is encountered
All, I am trying to write a script that updates a program on a remote machine, however the upgrade requires one or maybe two reboots.所有,我正在尝试编写一个脚本来更新远程机器上的程序,但是升级需要一两次重新启动。 When i run the powershell script, it triggers the upgrade and the machine is rebooted once, post reboot the upgrade doesn't resume unless any user account logs in to the machine;
当我运行 powershell 脚本时,它会触发升级并且机器重新启动一次,重新启动后升级不会继续,除非任何用户帐户登录到机器; post a user login the upgrade automatically resumes and the upgrade process triggers another reboot post which the upgrade is complete.
发布用户登录后,升级会自动恢复,升级过程会触发另一个升级完成的重启帖子。
Is there a way to achieve this?有没有办法实现这一目标? Below is what i am trying.
下面是我正在尝试的。
Invoke-Command -ComputerName $name -ScriptBlock { Unblock-File 'C:\\temp\\Install\\VDAServerSetup_1912.exe'; Start-Process -FilePath C:\\temp\\Install\\VDAServerSetup_1912.exe -ArgumentList '/components VDA', /disableexperiencemetrics, /enable_hdx_ports, /enable_hdx_udp_ports, /enable_real_time_transport, /enable_remote_assistance, '/includeadditional "Citrix Personalization for App-V - VDA"','/exclude "Personal vDisk","Machine Identity Service"', '/includeadditional "Citrix Personalization for App-V - VDA"', '/logpath "c:\\becnet\\xenapp"', /masterimage, /quiet, /virtualmachine, /disableexperiencemetrics, /optimize, /virtualmachine -wait}
I removed the copy code as that part works fine.我删除了复制代码,因为该部分工作正常。 The problem i face is that once the above code is triggered on the remote machine, the machine reboots as a part of the upgrade, but once the machine is back up, the upgrade gets stuck unless someone logs on to the machine.
我面临的问题是,一旦在远程机器上触发上述代码,机器将作为升级的一部分重新启动,但是一旦机器备份,升级就会卡住,除非有人登录到机器。 Is there a way this can be achieved unattended?
有没有办法在无人看管的情况下实现这一目标?
As pointed by Larry below, i had success with the Autologon enabled, however i would like to use that method as the last resort, Is there any other way this can be achieved?正如下面 Larry 所指出的,我在启用 Autologon 的情况下取得了成功,但是我想使用该方法作为最后的手段,还有其他方法可以实现吗?
You haven't quoted arguments properly.您没有正确引用参数。 And the c$ is a typo.
而 c$ 是一个错字。 Here's the fixed code:
这是固定代码:
Copy-Item -Path $Source_vda_path -Destination "\\$($name)\C:\$($temp)\Install\VDAServerSetup_1912.exe" -Force
Invoke-Command -ComputerName $name -ScriptBlock "{ & Unblock-File 'C:\temp\Install\VDAServerSetup_1912.exe'; Start-Process -FilePath 'C:\temp\Install\VDAServerSetup_1912.exe' -ArgumentList '/components VDA', '/disableexperiencemetrics', '/enable_hdx_ports', '/enable_hdx_udp_ports', '/enable_real_time_transport', '/enable_remote_assistance', '/includeadditional "Citrix Personalization for App-V - VDA"','/exclude "Personal vDisk","Machine Identity Service"', '/includeadditional "Citrix Personalization for App-V - VDA"', '/logpath "c:\becnet\xenapp"', '/masterimage', '/quiet', '/virtualmachine', '/disableexperiencemetrics', '/optimize', '/virtualmachine', -wait}"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.