├── .github └── FUNDING.yml ├── Deploy via SCCM and send message to logged in users ├── Install.bat ├── Remove.ps1 └── VDA Upgrade.ps1 ├── Install.bat ├── LICENSE ├── README.md ├── Remove.bat └── VDA Upgrade.ps1 /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [ChayScripts] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: https://www.buymeacoffee.com/SupportChay 13 | -------------------------------------------------------------------------------- /Deploy via SCCM and send message to logged in users/Install.bat: -------------------------------------------------------------------------------- 1 | REM change port number in below command. 2 | REM Use citrix vda command line helper tool from citrix. https://support.citrix.com/article/CTX234824 if needed 3 | REM Install new VDA agent, delete files and scheduled tasks. Finally reboot. 4 | 5 | c:\temp\VDAWorkstationSetup_1912.exe /controllers "DDCFQDN1 DDCFQDN2 DDCFQDN3" /noreboot /quiet /enable_remote_assistance /disableexperiencemetrics /enable_framehawk_port /enable_hdx_ports /enable_hdx_udp_ports /exclude "AppDisks VDA Plug-in","Citrix Files for Outlook","Citrix Files for Windows","Citrix Personalization for App-V - VDA","Personal vDisk" /PORTNUMBER 0000 /COMPONENTS VDA 6 | C:\Windows\system32\schtasks.exe /delete /tn VDAInstall /f 7 | C:\Windows\system32\schtasks.exe /delete /tn VDAUninstall /f 8 | del c:\temp\Remove.ps1 /F 9 | del c:\temp\VDAWorkstationSetup_1912.exe /F 10 | C:\Windows\System32\timeout.exe /t 5 11 | C:\Windows\System32\shutdown.exe /r /t 20 /f 12 | del c:\temp\install.bat /F 13 | -------------------------------------------------------------------------------- /Deploy via SCCM and send message to logged in users/Remove.ps1: -------------------------------------------------------------------------------- 1 | #If user is logged in to the VDI, sends message to user every 2 minutes. After 10 minutes, VDA uninstall script will start. 2 | #If user is not logged in, directly starts the VDA uninstall script. 3 | 4 | $Timer = 10 5 | while (Invoke-Command -ScriptBlock { quser }) { 6 | if ($Timer -ne "0") { 7 | msg * "This machine will be restarted in $Timer mins for Citrix VDA upgrade activity. Please save your work and disconnect from VDI." 8 | Start-Sleep -Seconds 120 9 | $Timer = $Timer - 2 10 | } 11 | else { 12 | msg * "Grace period complete. Starting VDA uninstall. Your VDI will reboot by itself. Try connecting after 2 hours." 13 | start-sleep -seconds 5 14 | Start-Process "C:\Program Files\Citrix\XenDesktopVdaSetup\XenDesktopVdaSetup.exe" -ArgumentList "/REMOVEALL /QUIET /NOREBOOT" -Wait 15 | Start-Sleep -Seconds 5 16 | Restart-Computer -Confirm:$false -Force 17 | } 18 | } 19 | 20 | if (!(Invoke-Command -ScriptBlock { quser })) { 21 | Start-Process "C:\Program Files\Citrix\XenDesktopVdaSetup\XenDesktopVdaSetup.exe" -ArgumentList "/REMOVEALL /QUIET /NOREBOOT" -Wait 22 | Start-Sleep -Seconds 5 23 | Restart-Computer -Confirm:$false -Force 24 | } 25 | 26 | -------------------------------------------------------------------------------- /Deploy via SCCM and send message to logged in users/VDA Upgrade.ps1: -------------------------------------------------------------------------------- 1 | if (!(Test-Path -Path C:\temp)) { 2 | New-Item -ItemType Directory -Path C:\ -Name Temp 3 | Copy-Item "\\server\Install.bat" -Destination C:\temp -Force 4 | Copy-Item "\\server\Remove.ps1" -Destination C:\temp -Force 5 | Copy-Item "\\server\VDAWorkstationSetup_1912.exe" -Destination C:\temp -Force 6 | } 7 | else { 8 | Copy-Item "\\server\Install.bat" -Destination C:\temp -Force 9 | Copy-Item "\\server\Remove.ps1" -Destination C:\temp -Force 10 | Copy-Item "\\server\VDAWorkstationSetup_1912.exe" -Destination C:\temp -Force 11 | 12 | } 13 | 14 | $time = (Get-Date).AddMinutes(3) 15 | $action = New-ScheduledTaskAction -Execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument "-noprofile -executionpolicy bypass -file c:\temp\Remove.ps1" 16 | $trigger = New-ScheduledTaskTrigger -Once -At $time 17 | $principal = New-ScheduledTaskPrincipal -RunLevel Highest -UserID "NT AUTHORITY\SYSTEM" -LogonType S4U 18 | 19 | Register-ScheduledTask -Action $action -Trigger $trigger -Principal $principal -TaskName "VDAUninstall" -Description "Citrix VDA Uninstall" 20 | 21 | $action = New-ScheduledTaskAction -Execute 'c:\temp\install.bat' 22 | $trigger = New-ScheduledTaskTrigger -AtStartup 23 | $principal = New-ScheduledTaskPrincipal -RunLevel Highest -UserID "NT AUTHORITY\SYSTEM" -LogonType S4U 24 | 25 | Register-ScheduledTask -Action $action -Trigger $trigger -Principal $principal -TaskName "VDAInstall" -Description "Citrix VDA Install" 26 | -------------------------------------------------------------------------------- /Install.bat: -------------------------------------------------------------------------------- 1 | REM change port number in below command. 2 | REM Use citrix vda command line helper tool from citrix. https://support.citrix.com/article/CTX234824 if needed 3 | REM Install new VDA agent, delete files and scheduled tasks. Finally reboot. 4 | 5 | c:\temp\VDAWorkstationSetup_1912.exe /controllers "DDCFQDN1 DDCFQDN2 DDCFQDN3" /noreboot /quiet /enable_remote_assistance /disableexperiencemetrics /enable_framehawk_port /enable_hdx_ports /enable_hdx_udp_ports /exclude "AppDisks VDA Plug-in","Citrix Files for Outlook","Citrix Files for Windows","Citrix Personalization for App-V - VDA","Personal vDisk" /PORTNUMBER 0000 /COMPONENTS VDA 6 | C:\Windows\system32\schtasks.exe /delete /tn VDAInstall /f 7 | C:\Windows\system32\schtasks.exe /delete /tn VDAUninstall /f 8 | del c:\temp\remove.bat /F 9 | del c:\temp\VDAWorkstationSetup_1912.exe /F 10 | C:\Windows\System32\timeout.exe /t 5 11 | C:\Windows\System32\shutdown.exe /r /t 20 /f 12 | del c:\temp\install.bat /F 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Tech Guy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Citrix-VDA-Upgrade-Scripts 2 | 3 | Scripts to upgrade Citrix VDA agent 4 | 5 | ## Description 6 | 7 | Upgrade Citrix VDA agent from one version to another version. Example 7.15 LTSR to 1912 LTSR. 8 | 9 | ### Prerequisites 10 | 11 | Download VDAWorkstationSetup_1912.exe from citrix downloads page. 12 | 13 | ### Usage 14 | 15 | * Customize and copy install.bat, remove.bat and VDAWorkstationSetup_1912.exe to a network share. 16 | * Run VDA upgrade.ps1 file. It will copy install.bat, remove.bat, and VDAWorkstationSetup_1912.exe from network share to c:\temp on every VDI in the list. 17 | 18 | ### How does it work 19 | 20 | * Creates Scheduled tasks - One for uninstalling existing VDA agent and another for installing new VDA agent. 21 | * Executes VDAUninstall scheduled task first. This scheduled task runs after 3 minutes it is created. Once started, it runs remove.bat file and restarts the VDA. 22 | * After reboot, it runs VDAInstall scheduled task. This scheduled task runs install.bat file. No user login is required. 23 | * After installation is complete, it deletes install.bat, remove.bat, VDAWorkstationSetup_1912.exe files from c:\temp and also deletes VDAuninstall, VDAInstall scheduled tasks. 24 | 25 | ### Built With 26 | 27 | * [PowerShell](https://en.wikipedia.org/wiki/PowerShell) 28 | * [Batch Script](https://en.wikipedia.org/wiki/Batch_file) 29 | 30 | ### Authors 31 | 32 | * **Chay** - [ChayScripts](https://github.com/ChayScripts) 33 | 34 | ### Contributing 35 | 36 | Please follow [github flow](https://guides.github.com/introduction/flow/index.html) for contributing. 37 | 38 | ### License 39 | 40 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details 41 | -------------------------------------------------------------------------------- /Remove.bat: -------------------------------------------------------------------------------- 1 | "C:\Program Files\Citrix\XenDesktopVdaSetup\XenDesktopVdaSetup.exe" /REMOVEALL /QUIET /NOREBOOT 2 | C:\Windows\System32\shutdown.exe /r /t 5 /f 3 | -------------------------------------------------------------------------------- /VDA Upgrade.ps1: -------------------------------------------------------------------------------- 1 | $vdilist = Get-Content C:\temp\list.txt 2 | 3 | foreach ($vdi in $vdilist) { 4 | Write-Host "Working on $vdi" 5 | if (!(Test-Path -Path \\$vdi\c$\temp)) { 6 | New-Item -ItemType Directory -Path \\$vdi\c$ -Name Temp 7 | Copy-Item "\\server\install.bat" -Destination \\$vdi\c$\temp -Force 8 | Copy-Item "\\server\remove.bat" -Destination \\$vdi\c$\temp -Force 9 | Copy-Item "\\server\VDAWorkstationSetup_1912.exe" -Destination \\$vdi\c$\temp -Force 10 | } 11 | else { 12 | Copy-Item "\\server\install.bat" -Destination \\$vdi\c$\temp -Force 13 | Copy-Item "\\server\remove.bat" -Destination \\$vdi\c$\temp -Force 14 | Copy-Item "\\server\VDAWorkstationSetup_1912.exe" -Destination \\$vdi\c$\temp -Force 15 | 16 | } 17 | Invoke-Command -ComputerName $vdi -Scriptblock { 18 | $time = (Get-Date).AddMinutes(3) 19 | $action = New-ScheduledTaskAction -Execute 'c:\temp\remove.bat' 20 | $trigger = New-ScheduledTaskTrigger -Once -At $time 21 | $principal = New-ScheduledTaskPrincipal -RunLevel Highest -UserID "NT AUTHORITY\SYSTEM" -LogonType S4U 22 | 23 | Register-ScheduledTask -Action $action -Trigger $trigger -Principal $principal -TaskName "VDAUninstall" -Description "Citrix VDA Uninstall" 24 | } 25 | 26 | Invoke-Command -ComputerName $vdi -Scriptblock { 27 | $action = New-ScheduledTaskAction -Execute 'c:\temp\install.bat' 28 | $trigger = New-ScheduledTaskTrigger -AtStartup 29 | $principal = New-ScheduledTaskPrincipal -RunLevel Highest -UserID "NT AUTHORITY\SYSTEM" -LogonType S4U 30 | 31 | Register-ScheduledTask -Action $action -Trigger $trigger -Principal $principal -TaskName "VDAInstall" -Description "Citrix VDA Install" 32 | 33 | } 34 | 35 | 36 | } 37 | 38 | --------------------------------------------------------------------------------