Error uninstalling the elastic agent

i am running the uninstall command where the command have to be run but still showing error

PS C:\Program Files\Elastic\Agent> .\elastic-agent.exe uninstall
Error: can only be uninstalled by executing the installed Elastic Agent at: C:\Program Files\Elastic\Agent\elastic-agent.exe
For help, please see our troubleshooting guide at

i have also tried the unistall command given on the kibana the command was

C:\"Program Files"\Elastic\Agent\elastic-agent.exe uninstall --uninstall-token 6a332b605df82adf0f4d1b9b96288902

if anyone need additional configuration leave a reply

Hi @Karan37,

Are you running the install command as administrator as per the documentation?

thanks for responding @carly.richmond
yes i was running as administrator only still the same error was showing up so i decided to delete all the files of the elastic agent in the program files but there was this Elastic Agent and fleet server processes that was continously running in the background still after stopping these process would start again within 5 seconds so i have to quickly stop then delete the files i think that kinda worked for me