This is often what I find people do with AI now, give it the task to do when getting it to writing a script is the correct solution.
Further the issue of exposing all your sensitive data to the AI provider.