VDAs are showing in Studio with a Registration State of "Agent Error" after upgrading the VDAs to CVAD 2402 CU3 or 2507 and above from CVAD 1912.
On inspection the registry entry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CtxUvi\UviStatusDisabled was set to 1.
Changing UviStatusDisabled to 0, allowed the VDAs to register but Application and Desktop sessions were not able to be launched.
The System Event log on the VDA had multiple Errors with Event ID 1005, Source CTXUVI starting from when the VDA booted.
Caution! Using Registry Editor incorrectly can cause serious problems that might require you to reinstall your operating system. Citrix cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. Be sure to back up the registry before you edit it.
Running process Monitor (Procmon) on system startup, and analysing the resultant log with the filter: Path + Contains + AppInit_DLLs

This showed there were legacy registry entries being written under under: HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\CtxHook\AppInit_DLLs and HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\CtxHook\AppInit_DLLs by a 3rd party application or script.
These legacy entries generated system errors when the Citrix hooking engine (CTXUVI) attempted to load legacy hooks that no longer exist in the code.
CTXUVI will automatically disable itself and set the UviStatusDisabled registry entry to 1, if it discovers a problem with loading any hooks.
When the Broker service detects this registry key, it unregisters the VDA to prevent users from connecting to a non-functioning VDA, and also marks it with "Agent Error" to alert the Citrix Admins that there is a problem with that VDA.
Removing the legacy registry keys and rebooting the VDA resolved the issue.
Caution! Refer to the Disclaimer at the end of this article before using the Registry Editor
For VDA 2402 and above the following are no longer valid:
For VDA 2507 and above the following are no longer valid:
After we prevented these reg keys from being pushed to those VDAs, they registered after a reboot.
VDAs are showing in Studio with a Registration State of "Agent Error" after upgrading the VDAs to CVAD 2402 or 2507 and above from CVAD 1912.
Process monitor: https://learn.microsoft.com/en-us/sysinternals/downloads/procmon