3

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; 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?

  • 2
    Indeed, some software requires you to login to resume installation. To achieve what you want, you can try to setup a system startup task in windows scheduler, for instance, start as a local user and launch "explorer", see if it is able to resume the task (check the VDA or msiexec process by task manager). If it is not helping, maybe simply setup a auto login with a local user and develop more scripts to handle post reboot activities after. see https://support.microsoft.com/en-au/help/324737/how-to-turn-on-automatic-logon-in-windows – Larry Song Jan 07 '20 at 05:03
  • Hi Larry, thanks for the inputs, i tried the task scheduler approach but that didnt work fine, however once i enable Autologon the script works fine. That being said i would like to use this as the last resort. For now i am still trying to figure a way to get all this incorporated within my script. – Rohit Kachroo Jan 07 '20 at 08:41

1 Answers1

0

You haven't quoted arguments properly. And the c$ is a typo. 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}"
Wasif
  • 14,755
  • 3
  • 14
  • 34
  • The changes specified by you don't make any difference to what the script is doing, the first statement is just to copy the installer and that is working fine as is without any changes. The trouble comes which the installer is kicked in the second line – Rohit Kachroo Dec 30 '19 at 10:04