...
To install Elastic search as a windows service follow Elastic search documentation
The service is going to run from the folder you run the command from. Thus you should properly move it into a dedicated “services” folder like the one you creates from the DC PowerShell script.
https://www.elastic.co/guide/en/elasticsearch/reference/8.1/zip-windows.html#windows-service
...