How do we run desktop automation with freeware tools (like AutoIT, Sikuli) in a virtual machine or a headless machine.
AutoIT, Sikuli or Kantu Automation all work fine in a virtual machine (e. g. Virtual Box). If you have a problem there, please provide details.
On the other hand, these tools need a desktop - so they can not run headless. This is by design. They can not be compared with tools like PhantomJS that just emulate a web browser.