I have come across a bug when trying to install the elastic agent (8.4.0) on Windows Server 2019 VMs on Azure via the instructions provided in the fleet documentation.
The startup script on the VM runs the following command (from PowerShell)
& "C:\{path_to_exe}\elastic-agent.exe" install --url={url} --enrollment-token={token} --tag "{tags}" -n
which throws this error:
Error: 1 error: GetFileVersionInfoSize failed: The system cannot find the file specified.
Using process monitor, we saw that it is failing to find C:\Windows\system32\ntoskrnl.exe, similar to the problem in these posts 1, 2 and Github issue (coresponding to post 1).
This file is actually located in the D: drive, so adding a symlink from C:\Windows\system32
to D:\Windows\sysem32
seems to fix the issue as the agent installs successfully and we can see data in Kibana.
Also note that unzipping the agent folder to D: and trying to install results in the same error.