Hi,
Your task is clear for me - i will create powershell script that will collect data by the query defined in separate file and store result in file - You can define naming pattern and format ( xml/json/csv - what fits best).
I have almost 6 years of experience in task automation using powershell/.net as IT architect.
I can provide You result in less than 3 hours, feel free to contact me via messages to talk about details.
Regards,
Sebastian.